Hi all,
I'm using Sharepoint's Copy.asmx webservice to upload legacy files and their metadata. The target is a custom list (with nested folders and custom fields - all as text - ).
The file upload is ok, their metadata is ok, CAML querying is ok,but....
One of my custom attribute is the doc_type. Due to time constraints I set this also as text. However if users start creating their own content, I'd prefer to maximize data sanity by using this doc_type as a Lookup field instead of free text.
I'd appreciate some help on how to set the FieldInformation collection properly.
It's overkill to post the whole code, but here is the pertinent portion. I start to create a detailed XML that represents every folder and file. The "file" node contains, as attributes, the metadata. This block of code is iterating over each node's attributes.
foreach (XmlAttribute attr in node.Attributes) { if (attr.Name.StartsWith("c_")) { spfinWSCopy.FieldInformation fi = new spfinWSCopy.FieldInformation(); fi.DisplayName = attr.Name; fi.InternalName = attr.Name; fi.Type = spfinWSCopy.FieldType.Text; fi.Value = attr.Value; spfields.Add(fi); } }
In the end, the WS is called using:
copyService.CopyIntoItems(destination , destinationURL , file.spfieldInfo , File.ReadAllBytes(AppSettings.getAppPropertyValue(CConstants.SOURCE_FOLDER_KEY_NAME) + "\\" + (file.destinationFolder).Replace("/","\\\\") + file.name) , out result);
Sorry for the long intro. The question is: how should I rewrite the following for Lookup fields?
fi.Type = spfinWSCopy.FieldType.Text; fi.Value = attr.Value;
Thanks, Pedro