Sharepoint Activity Add list item in list subfolder

Hi all,

I am using the activity SharePoint Custom Activities Package.

I’m trying to add a list item to a subfolder of the list like this:

image

I tried them all but I couldn’t figure out how.

So try asking for help @radu_bucur who created the activity or whoever can help me out.

Thanks a lot to anyone who can give me a little help

Hi welcome to the community!
Are you getting an error? Could you add an item to the root folder or nothing at all?

Hi @bcorrea thanks for the response,

I try many way.
I try to put the relative path of the folder like “List/ListName/Folder1/Folder2” or “ListName/Folder1/Folder2” and absolute path of the folder but the only way it works is when I put the list name in the field “List Name” otherwise UiPath says that this is not a List.
I try to modify the Prop dictionary editing the property “FileRefDir” or “ContentTypeID” but this property is read only.

since this activity dont support directly the use of folders, you may need to check which is the property the item need to have to tell sharepoint the sub folder you want it to go…

Hi Dario,
unfortunately, creating list items in a specific folder is not possible with the current package.
What you could do is use the Client Context returned by the SharePoint Scope and use that inside an invoke code:


image

This will add your item in a subfolder

1 Like

I will paste the code here, in case you choose to use it:
try
{

		List oList = SPContext.Web.Lists.GetByTitle("adsfdsaf");

        ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
		itemCreateInfo.FolderUrl = "asdfasdfasdfr";
        ListItem newItem = oList.AddItem(itemCreateInfo);
		 //set properties
        foreach (KeyValuePair<string, object> entry in properties)
        {
           newItem[entry.Key] = entry.Value;
        }

        //update list item
        newItem.Update();
		
SPContext.Load(newItem);
SPContext.ExecuteQuery();

}catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}

2 Likes

Hi @radu_bucur ,

I tried using this but unfortunately getting null output for Client Context. Could you please help.

I am trying to add list item inside a sub folder and problem is I don’t have Graph API setup.

Thanks,
Faizal