0

I am using following xml code (copy.asmx > method CopyIntoItems). Per Microsoft http://msdn.microsoft.com/en-us/library/websvccopy.copy.copyintoitems(v=office.14).aspx I should be able to update lookup fields value as well because Lookup list is on the same subsite and both source and target libraries are on the same sub-site as well. Any idea? Item gets copies and all the columns get populated except the lookup column. I verified that the ID and value matches for the lookup value. (by the way http is there I had to take it out b/c of the forum rule)

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="schemas.xmlsoap.org/soap/envelope/" xmlns:m="schemas.microsoft.com/sharepoint/soap/">
  <soap:Header>
  </soap:Header>
  <soap:Body>
    <m:CopyIntoItems>
      <m:SourceUrl>internal.col.com/sales/bymonth/Active/0973410.pdf</m:SourceUrl>
      <m:DestinationUrls>
        <m:string>internal.col.com/sales/bymonth/NonActive/0973410.pdf</m:string>
      </m:DestinationUrls>
      <m:Fields>
        <m:FieldInformation Type="Text" DisplayName="Sales Code" InternalName="SalesID" Value="99999"></m:FieldInformation>
        <m:FieldInformation Type="Text" DisplayName="Sales Person Name" InternalName="FullName" Value="TEST, John S."></m:FieldInformation>
        <m:FieldInformation Type="Choice" DisplayName="FileSection" InternalName="PersonnelFileSection" Value="1- New Hire Paperwork, ECA, Termination, LOA"></m:FieldInformation>
        <m:FieldInformation Type="Choice" DisplayName="FileCategory" InternalName="PersonnelFileCategory" Value="Termination Paperwork"></m:FieldInformation>
        <m:FieldInformation Type="Text" DisplayName="Year" InternalName="Record_x0020_Year" Value="2014"></m:FieldInformation>
        <m:FieldInformation Type="DateTime" DisplayName="Effective Date" InternalName="Anniversary" Value="04/22/2014 00:00:00"> </m:FieldInformation>
        <m:FieldInformation Type="Choice" DisplayName="Status" InternalName="Current_x0020_Status" Value="Terminated"></m:FieldInformation>
        <m:FieldInformation Type="Lookup" DisplayName="AreaCode" InternalName="AreaCode" Id="cdae6ca0-d49c-4971-a580-2adcd7a282f1"  Value="4;#1795004"></m:FieldInformation>        
        <m:FieldInformation Type="Text" DisplayName="Title" InternalName="Title" Value="TEST"></m:FieldInformation>
      </m:Fields>
      <m:Stream>base64Binary</m:Stream>
    </m:CopyIntoItems>
  </soap:Body>
</soap:Envelope>
  • Please share the link to the article you mentioned. – Phil Greer Apr 30 '14 at 19:50
  • Sorry. Just updated the post. – Sherry Burns Apr 30 '14 at 20:01
1

Here is a sweet Powershell script I use for fixing Lookup fields (they break often in my experience) Just plug in your parameters in the function call on bottom :

Add-PSSnapin Microsoft.Sharepoint.Powershell
Function Fix-LookupColumn ($webURL, $listName, $columnName, $lookupListName)
{
  #Get web, list and column objects
  $web = Get-SPWeb $webURL
  $list = $web.Lists[$listName]
  $column = $list.Fields[$columnName]
  $lookupList = $Web.Lists[$lookupListName]

  #Change schema XML on the lookup column
  $column.SchemaXml = $column.SchemaXml.Replace($column.LookupWebId.ToString(), $web.ID.ToString())
  $column.SchemaXml = $column.SchemaXml.Replace($column.LookupList.ToString(), $lookupList.ID.ToString())
  $column.Update()

#Write confirmation to console and dispose of web object
write-host "Column" $column.Title "in list" $list.Title "updated to lookup list" $lookupList.Title "in site" $web.Url
$web.Dispose()
}

Fix-LookupColumn -webURL http://server/site -listName "ListName" -columnName   "ColumnName" -lookupListName "LookupList"
  • Colbs, Thanks for the powershell script. Do you know a way to incorporate powershell script from workflow. The code I posted is in the workflow action item (calling a web service) – Sherry Burns May 1 '14 at 12:01
  • I have never done that. This would be more for a one off fix post render. I don't believe Lookup fields are supported through the copy webservice. If it is part of a workflow, maybe you can do it through the Object Model – Michael Colbs May 1 '14 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.