Hi everyone,
I'm using Power Automate and I'm trying to check if a sharepoint list exists on my sharepoint online site.
I managed to do this for Sharepoint groups using an HTTP request. so i did the same in this case but it doesn't seem to be working.
I create a variable that is an array, question the site, get the result and then depending on the fact that the array is empty or not, it goes in my condition.
the thing is if i set the variable as an array, it stops at my "Set Variable" and tells me the variable is an array and can't be initialized with a string.
if i set the variable as a string, it goes to the condition and doesn't seem to figure out that the length of my variable is ... 0 ... so it goes on the NO side and crashes because the list doesn't exist.
would anyone be able to help me on this ?
thanks a lot and regards
Solved! Go to Solution.
Hi @Kadd
That's not a valid expression as you are missing the ? for a start. You've put:
body('Send_an_HTTP_request_to_SharePoint_-_Check_list_exists')['d']['results']
Please try:
outputs('Send_an_HTTP_request_to_SharePoint_-_Check_list_exists')?['body']?['d']?['results']
Hi @DamoBird365 ,
yes, and error is the same " the variable varResult of type Object cannot be initialized or updated with value of type string. The variable only supports values of type Object"
Can you share the output from the history of the SharePoint HTTP request?
@Kadd ,
I think you need to check your expression for the set variable - try:
outputs('Send_an_HTTP_request_to_SharePoint')?['body']?['d']?['results']
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien
P.S. take a look at my new blog here
in my Set variable i have
body('Send_an_HTTP_request_to_SharePoint_-_Check_list_exists')['d']['results']
That's what i also did when checking if SP Groups exist in another workflow and this worked.
Hi @Kadd
That's not a valid expression as you are missing the ? for a start. You've put:
body('Send_an_HTTP_request_to_SharePoint_-_Check_list_exists')['d']['results']
Please try:
outputs('Send_an_HTTP_request_to_SharePoint_-_Check_list_exists')?['body']?['d']?['results']
Hi @DamoBird365 ,
ok so i added "outputs...." and now it seems to be good. I had to initilize the varResult as an array.
I still have a problem because between yesterday and today...my flow doesn't restart anymore but i did so many changes that it might come from this.
Anyway, now, this part seems to be good, i have to check the rest.
Thanks a lot for your help !!!
Hi,
Please use empty() function to check the object is null or not. For me it worked.
User | Count |
---|---|
16 | |
16 | |
14 | |
9 | |
8 |
User | Count |
---|---|
30 | |
28 | |
24 | |
23 | |
13 |