Search Results

Search found 1 results on 1 pages for 'thorben'.

Page 1/1 | 1 

  • SharePoint 2010 - Client Object Model - Add attachment to ListItem

    - by Thorben
    Hi, I have a SharePoint List to which I'm adding new ListItems using the Client Object Model. Adding ListItems is not a problem and works great. Now I want to add attachments. I'm using the SaveBinaryDirect in the following manner: File.SaveBinaryDirect(clientCtx, url.AbsolutePath + "/Attachments/31/" + fileName, inputStream, true); It works without any problem as long as the item that I'm trying to add the attachment to, already has an attachment that was added through the SharePoint site and not using the Client Object Model. When I try to add an attachment to a item that doesnt have any attachments yet, I get the following errors (both happen but not with the same files - but those two messages appear consistently): The remote server returned an error: (409) Conflict The remote server returned an error: (404) Not Found I figured that maybe I need to create the attachment folder first for this item. When I try the following code: clientCtx.Load(ticketList.RootFolder.Folders); clientCtx.ExecuteQuery(); clientCtx.Load(ticketList.RootFolder.Folders[1]); // 1 -> Attachment folder clientCtx.Load(ticketList.RootFolder.Folders[1].Folders); clientCtx.ExecuteQuery(); Folder folder = ticketList.RootFolder.Folders[1].Folders.Add("33"); clientCtx.ExecuteQuery(); I receive an error message saying: Cannot create folder "Lists/Ticket System/Attachment/33" I have full administrator rights for the SharePoint site/list. Any ideas what I could be doing wrong? Thanks, Thorben

    Read the article

1