cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
keef10
Regular Visitor

Trying to use Send an HTTP request to SharePoint and keep getting an error The expression is invalid

I am trying to create a folder on sharepoint so i can store documents/information from Salesforce. I have been attempting this for a few days and cannot understand why i keep getting either bad request or the expression is invalid.

 

Error is 

"message": "The expression \"web/GetFolderByServerRelativePath(decodedurl=’/sites/corporate-files/Lists/WIPTesting’)/AddSubFolderUsingPath(decodedurl=’')\" is not valid.\r\nclientRequestId: 4d0c8de6-a30f-400b-9956-54a516928376\r\nserviceRequestId: 23d3d39e-1052-0000-631e-051c3832d657",
"status": 400,
"errors": [
"-1",
"Microsoft.SharePoint.Client.InvalidClientQueryException"
]
}
 

Screenshot 2019-04-17 at 12.18.08.pngScreenshot 2019-04-17 at 12.19.06.pngScreenshot 2019-04-17 at 12.19.35.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

Hi @keef10 ,

 

First of all, Flow run history shows that you use Dynamic content-Name to appear to be null, so the decodedurl is followed by a null value. Please make sure the Name is not empty.

In addition, the error message shows "Expression is not valid" because your symbol is wrong. I guess you should paste Uri directly from the blog.

 

The single quotes in Uri inside the blog don't seem to be in English. Please use the following Uri:

_api/web/GetFolderByServerRelativePath(decodedurl='lists/ListName')/AddSubFolderUsingPath(decodedurl='@{triggerBody()?['{Name}']}')

Image reference:

15.PNG

Fun run history:

14.PNG

Please take a try again.

 

Edit:

In addition, these two actions suggest not to use the same list, otherwise it will cause a loop. Creating a folder is equivalent to creating a new item, which will trigger Flow again.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-bacao-msft
Community Support
Community Support

Hi @keef10 ,

 

First of all, Flow run history shows that you use Dynamic content-Name to appear to be null, so the decodedurl is followed by a null value. Please make sure the Name is not empty.

In addition, the error message shows "Expression is not valid" because your symbol is wrong. I guess you should paste Uri directly from the blog.

 

The single quotes in Uri inside the blog don't seem to be in English. Please use the following Uri:

_api/web/GetFolderByServerRelativePath(decodedurl='lists/ListName')/AddSubFolderUsingPath(decodedurl='@{triggerBody()?['{Name}']}')

Image reference:

15.PNG

Fun run history:

14.PNG

Please take a try again.

 

Edit:

In addition, these two actions suggest not to use the same list, otherwise it will cause a loop. Creating a folder is equivalent to creating a new item, which will trigger Flow again.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

MarkStokes
Skilled Sharer
Skilled Sharer

You have some dodgy single quotes in there.

 

Make sure your single quotes are ' and not angled in any way. They are different characters and invalidate your queries.

 

- Mark

This is why I always keep notepad open to copy/paste into first before copying text into SharePoint, Flow, etc. Formatting with copy/paste can be a nightmare. 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,041)