How can I add a link to a list item column that is of type hyperlink. The link should be a link to a subfolder in a document library.
What the program does it creates a new subfolder in a document library and after that I need to update a sharepoint list and create a list item with the details of the newly created document library subfolder, including a hyperlink to the subfolder. The list item field/column where the hyperlink is stored is labeled as File
I am using Microsoft.SharepointOnline.CSOM package with .net framework
Web web = clientContext.Web;
clientContext.Load(web, a => a.ServerRelativeUrl);
clientContext.ExecuteQuery();
// Create the subfolder in Sharepoint Document Library
Folder parentFolder = web.GetFolderByServerRelativeUrl(web.ServerRelativeUrl + "/" + parentFolderPath);
clientContext.Load(parentFolder);
clientContext.ExecuteQuery();
parentFolder.AddSubFolder(newSubFolderName, new ListItemUpdateParameters());
parentFolder.Folders.Add(newSubFolderName);
clientContext.Load(parentFolder);
clientContext.ExecuteQuery();
...
// Create a list item, need to add the hyperlink here in the field I have in my list called "File"
clientContext.Load(web.Lists,
lists => lists.Include(list => list.Title,
list => list.Id));
clientContext.ExecuteQuery();
List targetList = clientContext.Web.Lists.GetByTitle(listName);
ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
ListItem oListItem = targetList.AddItem(itemCreateInfo);
oListItem["File"] = ???
oListItem.Update();
clientContext.ExecuteQuery();