ListItem in 365 does not have the parentFolder

Hello Experts,

I need help with an automation issue, I appreciate any contribution.
I am trying to replace the activity Get List Items in this library in Sharepoint.Activities.List.ReadListItem with the 365 library the version is 2.6.25. The original activity uses a CAML query to filter by Status, Type of File and Parent Folder. However when I try to do the change in Get List items the schema changes and I can not filter by the ParentFolder which is neccessary.
This is the original activity
image
The activity in 365
The image displays a sequence of actions in a workflow: assigning an OData filter query, retrieving list information from a SharePoint site, and iterating through list items while applying the filter. (Captioned by AI)

The Odata filter at the moment:
“(fields/DocIcon eq ‘xlsx’) and (fields/Status eq ‘New’)”

  • Status is a column in sharepoint could be new, Manual…

Some Insights after multiple attempts:

  • I tried to get the ParentID from the ListItem according with the documentation in Graph API but the listItem does not find that property.
    image
  • I tried to use first a DriveItem object and then retrieve the information about the listItem but eh output is always null
    The image shows a debug console with the details of an object array element arrQueryFolder(7), displaying its Name, GetType, SharepointIds, and ListItem properties. (Captioned by AI)
  • I am not using DriveItem because I didnt find the way to retrieve the status.

Thanks

@juan.ramirez1

  1. Is it a document library or list?
  2. if document library then use get file/folder or for each file/folder

cheers

Thanks Anil, not sure if there is a Query to obtain the status for the output in those activites
I noticed the output is a driveItem an I can’t find the Status field in that object. Also with Find files but the result is empty. I dont know the file name, it can be uploaded any time.
This image shows the properties window for the "Find Files And Folders" activity in UiPath, with various fields such as Query, Subfolder, Drive Name, and Site Url filled out with some entries redacted. (Captioned by AI)

The status is available in the ListItem, the list is “Documents”. The original activity filters that list to obtain the output as datatable.

@juan.ramirez1

query in find files is to find using name alone…status and other columns are not supported…if you dont know name you can leave it blank it will get all items from given folder …if sub folders are present then give the path from folder after document library to the final folder you need

but in drive item there is an additional data method which gets the other columns from document library which can contain status and all…you can check that

drvitm.AdditionalData("Status")

better Open locals panel and check the drive item values if visible else use immediate panel to check the properties

cheers

This is an example of the DriveItem and I dont find the Status. When I use AdditionalData throws an exception
image

DriveItem {
AdditionalData = Dictionary<string, object>(1) {
{ “@microsoft.graph.downloadUrl”, ValueKind = String : “” }
},
Analytics = null,
Audio = null,
Bundle = null,
Children = null,
ChildrenNextLink = null,
Content = null,
CreatedBy = IdentitySet {
AdditionalData = null,
Application = null,
Device = null,
ODataType = null,
User = Identity {
AdditionalData = Dictionary<string, object>(1) {
{ “email”, ValueKind = String : “test@test.com” }
},
DisplayName = “test”,
Id = “be8a0c3e-b169-40f8”,
ODataType = null
}
},
CreatedByUser = null,
CreatedDateTime = [03/28/2024 21:12:46 +00:00],
CTag = “"c:{F2A202E9-C269-495A-},21"”,
Deleted = null,
Description = null,
ETag = “"{F2A202E9-C269-},15"”,
File = File {
AdditionalData = null,
Hashes = Hashes {
AdditionalData = null,
Crc32Hash = null,
ODataType = null,
QuickXorHash = “8vARPfp3XPXV=”,
Sha1Hash = null,
Sha256Hash = null
},
MimeType = “application/vnd.ms-excel.sheet.macroEnabled.12”,
ODataType = null,
ProcessingMetadata = null
},
FileSystemInfo = FileSystemInfo {
AdditionalData = null,
CreatedDateTime = [03/28/2024 21:12:46 +00:00],
LastAccessedDateTime = null,
LastModifiedDateTime = [04/04/2024 18:19:11 +00:00],
ODataType = null
},
Folder = null,
Id = “01E562SW7J”,
Image = null,
LastModifiedBy = IdentitySet {
AdditionalData = null,
Application = null,
Device = null,
ODataType = null,
User = Identity {
AdditionalData = Dictionary<string, object>(1) {
{ “email”, ValueKind = String : “test@test.com” }
},
DisplayName = “Zette”,
Id = “3d349877-1121-1234”,
ODataType = null
}
},
LastModifiedByUser = null,
LastModifiedDateTime = [04/04/2024 18:19:11 +00:00],
ListItem = null,
Location = null,
Malware = null,
Name = “Test RecIds.xlsm”,
ODataType = “microsoft.graph.driveItem”,
Package = null,
ParentReference = ItemReference {
AdditionalData = null,
DriveId = “b!8wMz8bNb”,
DriveType = “documentLibrary”,
Id = “01E56XV6T”,
Name = “QueryTest”,
ODataType = null,
Path = “/drives/b!8wMz8bNb7U”,
ShareId = null,
SharepointIds = null,
SiteId = “f13303f3-5bb3-1234”
},
PendingOperations = null,
Permissions = null,
PermissionsNextLink = null,
Photo = null,
Publication = null,
RemoteItem = null,
Root = null,
SearchResult = null,
Shared = Shared {
AdditionalData = null,
ODataType = null,
Owner = null,
Scope = “users”,
SharedBy = null,
SharedDateTime = null
},
SharepointIds = null,
Size = 2651117,
SpecialFolder = null,
Subscriptions = null,
SubscriptionsNextLink = null,
Thumbnails = null,
ThumbnailsNextLink = null,
Versions = null,
VersionsNextLink = null,
Video = null,
WebDavUrl = null,
WebUrl = “”,
Workbook = null
}

The status for that account in sharepoint is Member. Could be an issue with the permissions? The authentication is ApplicationID and Secret

@juan.ramirez1

not a permission issue I believe

1 thing you have the parent reference here which I believe is what you need

now coming to other columns…is status a custom column added to document library?

if you are not getting here…one way you can do is first using list activities get the required file name and then use get fiels and pass the filename in query to get the required file

cheers

Yes, it is a custom column added in Sharepoint

With the list Activities I need to filter by the parentFolder because the list is “Documents” and the bot can retrieve any file new, also with the object ListItem I didn’t find the parentID or folder among the properties. here an example of fields in the ListItem
Office365ListItemField[44] {
Office365ListItemField {
DisplayName=“Name”,
Name=“FileLeafRef”,
ReadOnly=false,
Value=“Email PO.xlsx”
},
Office365ListItemField {
DisplayName=“Status”,
Name=“Status”,
ReadOnly=false,
Value=“New”
},
Office365ListItemField {
DisplayName=“Image Tags”,
Name=“MediaServiceImageTags”,
ReadOnly=false,
Value=object[0] { }
},
Office365ListItemField {
DisplayName=“Content Type”,
Name=“ContentType”,
ReadOnly=false,
Value=“Document”
},
Office365ListItemField {
DisplayName=“Created”,
Name=“Created”,
ReadOnly=true,
Value=[10/06/2021 20:53:46]
},
Office365ListItemField {
DisplayName=“Created By”,
Name=“AuthorLookupId”,
ReadOnly=true,
Value=“30”
},
Office365ListItemField {
DisplayName=“Modified”,
Name=“Modified”,
ReadOnly=true,
Value=[01/14/2022 18:47:59]
},
Office365ListItemField {
DisplayName=“Modified By”,
Name=“EditorLookupId”,
ReadOnly=true,
Value=“26”
},
Office365ListItemField {
DisplayName=“Check In Comment”,
Name=“_CheckinComment”,
ReadOnly=true,
Value=“”
},
Office365ListItemField {
DisplayName=“Name”,
Name=“LinkFilenameNoMenu”,
ReadOnly=true,
Value=“Email PO To Vendor Output Report _20211006 015316.xlsx”
},
Office365ListItemField {
DisplayName=“Name”,
Name=“LinkFilename”,
ReadOnly=true,
Value=“Email PO To Vendor Output Report _20211006 015316.xlsx”
},
Office365ListItemField {
DisplayName=“Type”,
Name=“DocIcon”,
ReadOnly=true,
Value=“xlsx”
},
Office365ListItemField {
DisplayName=“File Size”,
Name=“FileSizeDisplay”,
ReadOnly=true,
Value=“30828”
},
Office365ListItemField {
DisplayName=“Item Child Count”,
Name=“ItemChildCount”,
ReadOnly=true,
Value=“0”
},
Office365ListItemField {
DisplayName=“Folder Child Count”,
Name=“FolderChildCount”,
ReadOnly=true,
Value=“0”
},
Office365ListItemField {
DisplayName=“Label setting”,
Name=“_ComplianceFlags”,
ReadOnly=true,
Value=“”
},
Office365ListItemField {
DisplayName=“Retention label”,
Name=“_ComplianceTag”,
ReadOnly=true,
Value=“”
},
Office365ListItemField {
DisplayName=“Retention label Applied”,
Name=“_ComplianceTagWrittenTime”,
ReadOnly=true,
Value=“”
},
Office365ListItemField {
DisplayName=“Label applied by”,
Name=“_ComplianceTagUserId”,
ReadOnly=true,
Value=“”
},
Office365ListItemField {
DisplayName=“Comment count”,
Name=“_CommentCount”,
ReadOnly=true,
Value=“”
},
Office365ListItemField {
DisplayName=“Like count”,
Name=“_LikeCount”,
ReadOnly=true,
Value=“”
},
Office365ListItemField {
DisplayName=“Sensitivity”,
Name=“_DisplayName”,
ReadOnly=true,
Value=“”
},
Office365ListItemField {
DisplayName=“Edit”,
Name=“Edit”,
ReadOnly=true,
Value=“0”
},
Office365ListItemField {
DisplayName=“Version”,
Name=“_UIVersionString”,
ReadOnly=true,
Value=“2.0”
},
Office365ListItemField {
DisplayName=“ID”,
Name=“ID”,
ReadOnly=true,
Value=“5”
},
Office365ListItemField {
DisplayName=“Compliance Asset Id”,
Name=“ComplianceAssetId”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“Title”,
Name=“Title”,
ReadOnly=false,
Value=null
},
Office365ListItemField {
DisplayName=“Description”,
Name=“_ExtendedDescription”,
ReadOnly=false,
Value=null
},
Office365ListItemField {
DisplayName=“Manual Worker”,
Name=“ManualWorkerLookupId”,
ReadOnly=false,
Value=null
},
Office365ListItemField {
DisplayName=“Notes”,
Name=“Notes”,
ReadOnly=false,
Value=null
},
Office365ListItemField {
DisplayName=“Shared With”,
Name=“SharedWithUsers”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“Shared With Details”,
Name=“SharedWithDetails”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“KeyPoints”,
Name=“MediaServiceKeyPoints”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“Vendor”,
Name=“Vendor”,
ReadOnly=false,
Value=null
},
Office365ListItemField {
DisplayName=“Date PO Created”,
Name=“DatePOCreated”,
ReadOnly=false,
Value=null
},
Office365ListItemField {
DisplayName=“Extracted Text”,
Name=“MediaServiceOCR”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“Color Tag”,
Name=“_ColorTag”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“Copy Source”,
Name=“_CopySource”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“Checked Out To”,
Name=“CheckoutUserLookupId”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“Item is a Record”,
Name=“_IsRecord”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“App Created By”,
Name=“AppAuthorLookupId”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“App Modified By”,
Name=“AppEditorLookupId”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“Source Version (Converted Document)”,
Name=“ParentVersionString”,
ReadOnly=true,
Value=null
},
Office365ListItemField {
DisplayName=“Source Name (Converted Document)”,
Name=“ParentLeafName”,
ReadOnly=true,
Value=null
}
}

I am going to check if there is any property in the Listitem that I can compare with the parentReference from the DriveItem.

@juan.ramirez1

  1. Using list item have only status and value filters
  2. then use the get file/folder with all the names in step1 and then filter on the parent folder so that only the required files are left from the get files

so your flow would be

  1. Get list item with status and value filter
  2. now loop on the filename field from step1
  3. inside loop use get file/folder and then from the driveitem check if the parent folder is as per your folder requirement…if yes that is the file if no move to next file in the loop

Hope this helps

cheers

1 Like

Thank you so much Anil, I changed a little the approach because the loop with the Get file was taking so time. I retrieve first the fileName list with the Listactivites then the FileNames list in the folder with DriveItem and the Intersect both, but yes It is the same approach.

Thank you

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.