1

I'm working on a script and I can call the below Graph API endpoint.

https://graph.microsoft.com/v1.0/me/insights/used

without any issue. But I would like to use filter like so:

var srchStr = "ABC" - Name of site
     
graphEndPoint: "https://graph.microsoft.com/v1.0/me/insights/used?$filter=ResourceVisualization/containerDisplayName eq '"+ srchStr + "'"

graphEndPoint:"https://graph.microsoft.com/v1.0/me/insights/used?$filter=substringof('"+ srchStr + "', ResourceVisualization/containerDisplayName)"

But I keep getting error:

{"error":{"code":"BadRequest","message":"Invalid filter clause","innerError

My goal is to list the documents that a user has viewed or modified for a specific document library.

Is this possible?

2 Answers 2

1

You cannot apply filter query based on the ContainerDisplayName property.

Also, ContainerDisplayName property does not provide the name of specific document library. It is:

A string describing where the item is stored. For example, the name of a SharePoint site or the user name identifying the owner of the OneDrive storing the item.

Source: resourceVisualization resource type


Also, The contains or substringof string operator is currently not supported on any Microsoft Graph resources.

Source: Use query parameters to customize responses


Currently, you can filter on containerType property, but it will only tell you if the file is stored in SharePoint site or OneDrive for Business.

Example:

https://graph.microsoft.com/v1.0/me/insights/used?$filter=ResourceVisualization/containerType eq 'Site'
2
  • 1
    Thanks guys but its rather unfortunate. As i could have used the containerWebUrl with contain to get the document library name. Are there any other options
    – naijacoder
    Commented Jun 16, 2021 at 7:47
  • Yes, I was thinking of suggesting to use containerWebUrl for filtering. But unfortunately graph API does not support contains operator as of now. Also, used endpoint does not support $search :( Commented Jun 16, 2021 at 8:04
1

We cannot filter on the property 'ContainerDisplayName'.

I did a test in Graph explorer and got this error: "The property 'ContainerDisplayName' does not support filtering."

enter image description here

2
  • Thanks Michael. But do you have any other suggestions?
    – naijacoder
    Commented Jul 21, 2021 at 23:12
  • Figured another way out. Tanks all
    – naijacoder
    Commented Jul 26, 2021 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.