HI,
I need to upload file into share point online (2013) using C# with a live id test@outlook.com. I am using the below code
string siteUrl = "https://microsoft.sharepoint.com/xxx/yyyy";
string filePath = Console.ReadLine();
ClientContext context = new ClientContext(siteUrl);
SecureString passWord = new SecureString();
foreach (var c in "password") passWord.AppendChar(c);
context.Credentials = new SharePointOnlineCredentials("test@outlook.com", passWord);
Web site = context.Web;
//Get the required RootFolder
string barRootFolderRelativeUrl = "Shared Documents/abc/Main";
Folder barFolder = site.GetFolderByServerRelativeUrl(barRootFolderRelativeUrl);
Folder currentRunFolder = site.GetFolderByServerRelativeUrl(barRootFolderRelativeUrl);
FileCreationInformation newFile = new FileCreationInformation { Content = System.IO.File.ReadAllBytes(filePath), Url = System.IO.Path.GetFileName(filePath), Overwrite = true };
currentRunFolder.Files.Add(newFile);
currentRunFolder.Update();
context.ExecuteQuery();
But I am getting below exception:
An unhandled exception of type 'Microsoft.SharePoint.Client.IdcrlException' occurred in Microsoft.SharePoint.Client.Runtime.dllAdditional information: The Login server cannot issue the requested compact encrypted ticket because a Data Encryption Key (DEK) has not been uploaded to the site.
Please help me to resolve this.
Thanks,
Trinadh