Answered Attach a new document to wiki page Client object model

  • Saturday, April 28, 2012 8:08 PM
     
     

    Hi,

    can we attach a document to existing wiki page using client object model

All Replies

  • Saturday, April 28, 2012 8:11 PM
     
     

    Basically a wikipage is sharepoint item in a list

    So you can deal with it the same way check the details below

    http://stackoverflow.com/questions/3718389/sp-2010-attach-file-client-object-model

    PLease mark as asnwered or vote as helpful if it is


    If the reply was helpful or informative, please remember to mark it as answer or vote as helpful. MCITP SHAREPOINT

  • Saturday, April 28, 2012 9:14 PM
     
     Answered Has Code

    Client object model doesn't support adding attachments to list items (Microsoft confirm that).

    You should use web services (lists.asmx) to add attachments.

    private void AddAttachment(ClientContext cc, string listName, string itemId, string fileName, byte[] fileContent)
    {
        try
        {
            var listsSvc = new ListsWS.Lists
                        {
                            Credentials = cc.Credentials,
                            Url = cc.Web.Context.Url + "_vti_bin/Lists.asmx"
                        };
            listsSvc.AddAttachment(listName, itemId, fileName, fileContent);
        }
        catch (Exception exception)
        {
        }
    }


    Don't happy, be worry...


    • Edited by Aviw_ Saturday, April 28, 2012 9:15 PM
    • Marked As Answer by Shimin Huang Friday, May 04, 2012 7:09 AM
    •  
  • Saturday, April 28, 2012 9:19 PM
     
     
    Aviw is right I thought u meant object model did not pay attention to client

    If the reply was helpful or informative, please remember to mark it as answer or vote as helpful. MCITP SHAREPOINT