Dear all, before posting this question I already look for any resources that can help but can't find any (there are some related questions but they are either outdated - posted almost 10 years ago - or not exactly what I need).
My problem is I need to write a code in c++ that will connect and upload a file in a sharepoint site using sharepoint.dll. Most of my projects are written in C# where I am most comfortable and I'm new with almost no knowledge in c++.
I already have my code written and tested to work fine in C# (eg. able to authenticate and upload a file in the Sharepoint site) but the thing is I don't know how to write it in c++. I was wondering if any of you can share the simplest code you have where I can connect, authenticate and upload a file in c++?
Here's how I did it in c#:
//Connect to SP site
ClientContext ctx = new ClientContext(siteCollUrl); //siteCollUrl = my SP url
SecureString secureString = new SecureString();
password.ToList().ForEach(secureString.AppendChar);
ctx.Credentials = new SharePointOnlineCredentials(userName, secureString);
Site mySite = ctx.Site;
ctx.Load(mySite);
ctx.ExecuteQuery();
//Upload a file
string libraryName = "Documents";
string fileName = filePath.Substring(filePath.LastIndexOf("\\") + 1);
FileCreationInformation fcinfo = new FileCreationInformation();
fcinfo.Url = fileName;
fcinfo.Overwrite = true;
fcinfo.Content = System.IO.File.ReadAllBytes(filePath);
Web web = ctx.Web;
List myLibrary = web.Lists.GetByTitle(libraryName);
myLibrary.RootFolder.Files.Add(fcinfo);
ctx.ExecuteQuery();
As you can see, almost all the methods are from the Sharepoint.dll but I can't find any example that uses the same in C++.
I'm using VS2019 with the latest framework.
TIA!