locked
Powershell Update Script Not Updating RRS feed

  • Question

  • Hi,

    I am having issues with a broken document information panel when using a template similar to what is described in http://wss.boman.biz/Lists/Posts/Post.aspx?ID=82. I have created a PowerShell script based on the suggestions in the above blog but the SourceID value is not being updated. Any suggestions would be appreciated. Below you will find the script.

    Thanks,

    Tim

    function Apply-Fix($siteUrl)
    
    {
        clear
        Add-PSSnapin "Microsoft.SharePoint.Powershell" -ErrorAction SilentlyContinue # -EA 0
        [Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
    
     #$$spSite = Get-SPSite $siteUrl
            $web = Get-SPWeb $siteUrl
    
     
    
             Write-Host "Checking Web: " $web.Url
    
    
         #foreach($list in $web.Lists)
                            $list = $web.Lists["Amendment Bylaw"]
    
               
        Write-Host $list.Title
           $fields = $list.fields
        foreach($field in $fields)
                 {
                                            if($field.SourceId.ToString().StartsWith('{$ListId:'))
                       {
                                                 Write-Host "SourceId= " $field.SourceId
                $schemaxml = $field.SchemaXML
                            $schemaxmldata = [xml]$schemaxml
                            #$schemaxmldata.Field.SetAttribute("SourceID", $list.ID)
                                                    $schemaxmldata.Field.SetAttribute("SourceID", ("{" + $list.ID + "}"))
                          $schemaxml = $schemaxmldata.get_InnerXml()
                           $field.SchemaXML = $schemaxml
                            $field.Update() 
                           Write-Host "Fixed" $field.Title "field"
                       } 
    
                 }
    
              $web.Dispose()
    
       Write-Host "Done."
    }
    
    Apply-Fix -siteUrl http://SharePointSite
    

    Monday, February 18, 2013 8:00 PM

Answers

  • Hi Tim,

    The SPField.SourceId (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfield.sourceid.aspx) property is a read-only property and you will need to make use of an Administrator: PowerShell window to read the property value.

    If you are not seeing a value for the property, you might have to place a breakpoint and do some live debugging to see what the actual issue is in your environment. The value of SPField.SourceId would usually be preceded by the GUID of your list Id.

    If you need assistance with finding the issue that is specific to your environment, I would recommend you to open a support case with Microsoft Support. An engineer from our Project team will then be dedicated to investigate and work the issue.

    -Vijay

    Monday, February 25, 2013 9:14 AM

All replies

  • Hi,

    Thank you for your question. I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience. Thank you for your understanding and support.

    Thanks,

    Entan Ming


    Entan Ming
    TechNet Community Support

    Wednesday, February 20, 2013 3:14 AM
  • Hi Tim,

    The SPField.SourceId (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfield.sourceid.aspx) property is a read-only property and you will need to make use of an Administrator: PowerShell window to read the property value.

    If you are not seeing a value for the property, you might have to place a breakpoint and do some live debugging to see what the actual issue is in your environment. The value of SPField.SourceId would usually be preceded by the GUID of your list Id.

    If you need assistance with finding the issue that is specific to your environment, I would recommend you to open a support case with Microsoft Support. An engineer from our Project team will then be dedicated to investigate and work the issue.

    -Vijay

    Monday, February 25, 2013 9:14 AM