I am reading through this post Upload a file to SharePoint through the built-in web services where upload is done in WSS. I am using SP 2010. Is there a piece of code already posted here that will add an item (via .net interface) using foundation web-services where content type is "XYX" as the target library has about 8 CT associated with it. (with metadata, using hashtable). I would hate to re-invent the wheel if someone already went through this scenario. I forgot about what account to use (like a service account) or user authentication.

How do I add an item with metadata to library for a specific content type using webservices in SP2010?


You'll need to populate the FieldInformation array. Using the code from the linked question, here is an example:

// Populated FieldInformation!
SharePoint2007CopyService.FieldInformation information = new 
information.DisplayName = "Content Type";
information.InternalName = "ContentType";
information.Type = FieldType.Choice;
information.Value = "XYZ";

SharePoint2007CopyService.FieldInformation[] info = { information };

I typed this using the references below.. haven't tested yet. :)

See also:

| improve this answer | |

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.