Jun 27, 2013

Customize the Document Information Panel for Word in SharePoint 2010

Sometimes you need the fields in the Document Information Panel in Word to be read-only or even hidden.

With InfoPath 2010, you can edit the Document Information Panel for a particular content type in a SharePoint Document Library.

Here are instructions:  http://msdn.microsoft.com/en-us/library/ms563688.aspx

As a side note, you can't make Quick Parts read-only, but you can make a section read-only in Word: http://nerdsrealm.blogspot.com.es/2013/03/how-to-restrict-editing-in-word-2010.html

Jun 11, 2013

Publish SharePoint 2010 workflows from Powershell

I came across this problem when we moved a site collection from one domain to another and all the workflows needed to be republished.

The Powershell script is pretty straightforward, except for one gotcha:  when setting the URI for a webservice proxy in Powershell, the webservice URL is always reset to the root webservice.

 Eg. http://server/subsite/_vti_bin/webpartpages.asmx  becomes http://server/_vti_bin/webpartpages.asmx.  You can later change the proxy object url to the correct URL.

 This showed up in the SharePoint logs as "SOAP exception: System.IO.FileNotFoundException: The system cannot find the specified file." and the webservice would only return a generic SOAPException. 

Here's the Powershell script:

$site = Get-SPSite http://server
$username = "domain\admin"
$password = "apassword"
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
$URI = "http://server/_vti_bin/webpartpages.asmx"
$proxy = New-WebServiceProxy -Uri $URI -Credential $cred

foreach($web in $site.AllWebs) {
    Try {
        $subFolders = $web.Folders["Workflows"].SubFolders;
        foreach($folder in $subFolders) {
            if($folder.Name -ne "Forms") {
                $xomlConfigFile = $folder.Files[$folder.Name+".xoml.wfconfig.xml"]
                Write-Host $xomlConfigFile.Name $xomlConfigFile.UIVersionLabel
                # The web service proxy sets the URL to root, so we reset it to the subsite
                $proxy.Url = $web.Url+"/_vti_bin/webpartpages.asmx"
                $result = $proxy.AssociateWorkflowMarkup($xomlConfigFile.Url,"V"+$xomlConfigFile.UIVersionLabel)
                Write-Host $result
    } Catch {




Jun 3, 2013

Variable Excel cell references

I just learned a new Excel function today: the INDIRECT function.

It allows you to put together a cell reference from text strings.


  =INDIRECT("sheet1!"&variableColumn&"2)  If there is a cell named 'variableColumn' with the text 'A', then this will return the value in "sheet1!A2"

=INDIRECT(A3&"2)  If A3 has the text 'B', then this will return the value in B2