question

JunTingHo-0477 avatar image
0 Votes"
JunTingHo-0477 asked JunTingHo-0477 commented

Azure Logic Apps: Error when copying file from OneDrive to Azure File Storage

I am trying to copy a file from OneDrive to Azure File Storage but am unable to do so.

The flow ("Path" is supposed to be taken from "Get file metadata" of the file to be copied):

112875-20210708-microsoftteams-image.png

The error in visual form:

112844-microsoftteams-image-3.png

The raw output of the error:

 {
    
     "statusCode": 400,
    
     "headers": {
    
         "Pragma": "no-cache",
    
         "x-ms-request-id": "cb121159-f663-44f4-a5cc-2461150b3684",
    
         "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
    
         "X-Content-Type-Options": "nosniff",
    
         "X-Frame-Options": "DENY",
    
         "Cache-Control": "no-store, no-cache",
    
         "Set-Cookie": "ARRAffinity=9227faf24135ad53dd065beee547fecb0ff01774dd3486105eba5bed7b415073;Path=/;HttpOnly;Secure;Domain=azurefile-sea.azconn-sea.p.azurewebsites.net,ARRAffinitySameSite=9227faf24135ad53dd065beee547fecb0ff01774dd3486105eba5bed7b415073;Path=/;HttpOnly;SameSite=None;Secure;Domain=azurefile-sea.azconn-sea.p.azurewebsites.net",
    
         "Timing-Allow-Origin": "*",
    
         "x-ms-apihub-cached-response": "true",
    
         "Date": "Wed, 07 Jul 2021 10:14:15 GMT",
    
         "Content-Length": "250",
    
         "Content-Type": "application/json",
    
         "Expires": "-1"
    
     },
    
     "body": {
    
         "status": 400,
    
         "message": "File name is null or empty.\r\nclientRequestId: cb121159-f663-44f4-a5cc-2461150b3684",
    
         "error": {
    
             "message": "File name is null or empty."
    
         },
    
         "source": "azurefile-sea.azconn-sea.p.azurewebsites.net"
    
     }
    
 }

Does anyone know what I'm doing wrong and how to rectify it? Where does this "source" come from or what is it referring to?

EDIT: I saw somewhere that suggested to use "Create file" instead, but I cannot select anything in "Folder path" to do so with:

112733-20210708-screenshot-2021-07-08-130905.jpg


azure-logic-appsazure-filesoffice-onedrive-client-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered JunTingHo-0477 commented

Hi @JunTingHo-0477

The error is expected behavior as I see that you are using the source URL as Path of Get file metadata that returns BlobMetaData that has the Path which is The path of the file or folder of the onedrive.

As you can see that the Path returns the right value in your case i.e. sL4ALP-file.txt but the Copy File accepts its as Source URL which is incorrect as the file name is passed. The copy File action needs the publicly accessible URL or the file share that you have configured so it can get the content and write the content to your destination path specified. I don't see any option to get the direct downloaded URL for the onedrive file that you can pass to the Copy File action. We do have the Create Share link connector that have SharingLink as output but your onedrive/organization should allow the publicly access URL. Once you have shared link then you can offload the functionality to azure function/your own logic to get the direct link and pass it to your Copy File action.

Alternative as you are using Get File Content action you can pass the output to Create file action of azure file. Please review the limitation of the connectors.

Feel free to get back to me if you have any queries or concerns.

· 10
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Sir,

I am helping my teammate to post a reply because he has technical issues.

He cannot find the SharingLink action in the OneDrive for Business, only the "Create share link" and "Create share link by path". When he tried that, however, he got this problem even though he is already connected to the organisation:

112922-microsoftteams-image.png112923-microsoftteams-image-1.png

The raw output of the error is as follows:

 {
 "statusCode": 403,
 "headers": {
 "Pragma": "no-cache",
 "Transfer-Encoding": "chunked",
 "x-ms-request-id": "190cf19a-5f1c-4c48-8c5e-0e86874af219",
 "Timing-Allow-Origin": "*",
 "x-ms-apihub-cached-response": "true",
 "Cache-Control": "no-cache",
 "Date": "Thu, 08 Jul 2021 05:19:39 GMT",
 "X-AspNet-Version": "4.0.30319",
 "X-Powered-By": "ASP.NET",
 "Content-Type": "application/json",
 "Expires": "-1",
 "Content-Length": "152"
 },
 "body": {
 "status": 403,
 "message": "The feature has been disabled. Please contact your admin to get it enabled.",
 "source": "api.connectorp.svc.ms"
 }
 }

(Continued in next comment because of post length limit)



0 Votes 0 ·

He tried to use the link direct from OneDrive:

112914-microsoftteams-image-2.png

Still same error message:

112864-microsoftteams-image-3.png

Raw output of error:

 {
     "statusCode": 400,
     "headers": {
     "Pragma": "no-cache",
     "x-ms-request-id": "a4d79866-f443-4fb7-927e-55ae52391a15",
     "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
     "X-Content-Type-Options": "nosniff",
     "X-Frame-Options": "DENY",
     "Cache-Control": "no-store, no-cache",
     "Set-Cookie": "ARRAffinity=44681089155cffee5d6ea46eb43a0a3c4b551bd2ba6e6eff95774f120dc70b73;Path=/;HttpOnly;Secure;Domain=azurefile-sea.azconn-sea.p.azurewebsites.net,ARRAffinitySameSite=44681089155cffee5d6ea46eb43a0a3c4b551bd2ba6e6eff95774f120dc70b73;Path=/;HttpOnly;SameSite=None;Secure;Domain=azurefile-sea.azconn-sea.p.azurewebsites.net",
     "Timing-Allow-Origin": "*",
     "x-ms-apihub-cached-response": "true",
     "Date": "Thu, 08 Jul 2021 05:24:12 GMT",
     "Content-Length": "250",
     "Content-Type": "application/json",
     "Expires": "-1"
     },

(Cont in next because of length)




0 Votes 0 ·
 "body": {
 "status": 400,
 "message": "File name is null or empty.\r\nclientRequestId: a4d79866-f443-4fb7-927e-55ae52391a15",
 "error": {
 "message": "File name is null or empty."
 },
 "source": "azurefile-sea.azconn-sea.p.azurewebsites.net"
 }
 }

(Raw output of error message from using OneDrive direct link ends here)

As you can see in the updated question, he has tried using "Create file", but he cannot select anything in "Folder path". How does he resolve this?

0 Votes 0 ·

@MarkJZYeap-8668 There was typo and I mean to say "Create Share link connector that have SharingLink as output". The above error is expected as I mentioned in my answer as your organization doesn't allow you to create the Anonymous link scope for this option would not be possible for you.

For the error "File name is null or empty" it is because you have not specified the file share name. In the Destination file path it should be "yourfileseverpath/copy-test-2.txt".
Once you fix the above issue then you will get 403 error (authentication issue) as your sharepoint path is not Anonymous accessible as mentioned previously.

The best way would be using Get File Content action you can pass the output to Create file action of azure file as mentioned in my answer.

0 Votes 0 ·

Hi Sir,

What about the "Folder path" showing "No items" when I try to use "Create file" with the Azure File Storage connector, as shown in the screenshot in the updated question? How can I resolve this issue?

0 Votes 0 ·
Show more comments

@MarkJZYeap-8668 The same I have mentioned in your query here.

112886-image.png

Please let me know if you need any assistance and we can connect offline.

0 Votes 0 ·
image.png (21.5 KiB)