I want to insert the Items in the Document Library for Content type "Linked to a Documents"

The document are in the local folder and the reference should go into the document library using "linked to a Document"

This i need to do using client obejct model.

Note: I have done all the configuration .I need to add items to the library Need help on this.

Thank you for your help in advance KK

1 Answer 1


First, create document library A and add all the docs through Windows explorer. Then create a second document library B and foreach file in A:

    SPListItem item = file.Item;
    item["Content Type"] = "Link to a Document";
    SPFieldUrlValue itemUrl = new SPFieldUrlValue();
    itemUrl.Description = "From sample code";
    itemUrl.Url = fileLinkUrl;
    item["URL"] = itemUrl;
    //persist changes

See : http://blogs.msdn.com/b/cliffgreen/archive/2008/06/23/creating-a-link-to-a-document-item-in-a-sharepoint-document-library-programmatically.aspx for creating a link to a document content type and

http://msdn.microsoft.com/en-us/library/office/ee539976(v=office.14).aspx for creating an item in scom

  • Thanks for the reply XristosK. Can you please share me the full code.I need help of how to get the file property. Thanksfor your help,KK
    – Karunakar
    Sep 11, 2014 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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