This question is locked. New answers and comments are not allowed.
I'm trying to construct a stand-alone web resource for CRM and I'm wondering if I have to provide an upload handler to the control?
I had planned to just do something like this using the SharePoint Client Object Model from the FileUploading event in my xaml code behind:
So is this possible or does the control need to offload to a handler to perform this type of action?
Thanks.
I had planned to just do something like this using the SharePoint Client Object Model from the FileUploading event in my xaml code behind:
public void UploadDocument(string siteURL, string documentListName, string documentListURL, string documentName, byte[] documentStream) { using (ClientContext clientContext = new ClientContext(siteURL)) { //Get Document List List documentsList = clientContext.Web.Lists.GetByTitle(documentListName); var fileCreationInformation = new FileCreationInformation(); //Assign to content byte[] i.e. documentStream fileCreationInformation.Content = documentStream; //Allow owerwrite of document fileCreationInformation.Overwrite = true; //Upload URL fileCreationInformation.Url = siteURL + documentListURL + documentName; Microsoft.SharePoint.Client.File uploadFile = documentsList.RootFolder.Files.Add(fileCreationInformation); //Update the metadata for a field having name "DocType" //uploadFile.ListItemAllFields["DocType"] = "Favourites"; //uploadFile.ListItemAllFields.Update(); clientContext.ExecuteQuery(); } }So is this possible or does the control need to offload to a handler to perform this type of action?
Thanks.