I originally posted under RowLimit from Client Object Model but have gotten past the row limit issue. My problem is that I am able to access lists from the client and return list items but the RootFolder.ServerRelativeURL gives this error:
The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
I am currently inserting to another list by using ListItemCreationInformation object but in this case, I need to load a PDF into the library so I'm trying to do an add against the list folder but since I can't get the relative path, I can't execute the add. I can access the list, and iterate through the properties but can't get the URL (SchemaXML
CamlQuery query = new CamlQuery();
query.ViewXml = @"<View><Query></Query><RowLimit>10</RowLimit></View>";
List archiveList = ctx.Web.Lists.GetByTitle("Doc Archive");
ctx.Load(archiveList);
ctx.ExecuteQuery();
ListItemCollection listItems = archiveList.GetItems(query);
ctx.Load(listItems, li =>
li.Include(
i => i["CARPOS_x0020_FCN"],
i => i["Case_x0020_Number"],
i => i["Court_x0020_Code"],
i => i["Doc_x0020_Type"],
i => i["CMU_x0020_Branch"]
).Where(i => (string)i["CARPOS_x0020_FCN"] != serviceTicket.fcnNumber));
ctx.ExecuteQuery();
Folder folder = archiveList.RootFolder;
var fileInfo = new FileCreationInformation();
fileInfo.Content = serviceTicket.ticketPDF;
fileInfo.Overwrite = true;
fileInfo.Url = archiveList.RootFolder.ServerRelativeUrl;
SP.File file = folder.Files.Add(fileInfo);
I did not create the lists in Sharepoint and don't know their location. Is this something that had to be set up? I don't know what my next steps would be at this point.
Thanks,
Jim