Copy file/folder from local to onedrive

Hi,

I am using office 365 activity to create folder in one drive, the folder variable is saved as DriveItem, Now during next bot run I want to check whether that folder name already exist or not, if not exist bot have to create new folder. Now my problem is I am unable to extract the file name from DriveItem. Can some one provide me the exact syntax to extract the folder name as string so I can use IF condition to check whether the folder exist or not.

I want to extract Name=“office365test”. I tried to use split string and it didnt work.

Or any other method to check whether the folder in one drive already exist or not.

Below is the value from the folder variable.

DriveItem[1]
{
DriveItem
{
AdditionalData=null,
Analytics=null,
Audio=null,
Children=null,
Content=null,
CreatedBy=null,
CreatedByUser=null,
CreatedDateTime=[07/24/2019 06:28:01 +00:00],
CTag=null,
Deleted=null,
Description=null,
ETag=null,
File=null,
FileSystemInfo=FileSystemInfo
{
AdditionalData=null,
CreatedDateTime=[07/24/2019 06:28:01 +00:00],
LastAccessedDateTime=null,
LastModifiedDateTime=[07/24/2019 06:28:01 +00:00],
ODataType=null
},
Folder=Folder
{
AdditionalData=null,
ChildCount=0,
ODataType=null,
View=null
},
Id=“01O5GMBBOF5BTWE2AELJALHGMKITIKJAJX”,
Image=null,
LastModifiedBy=null,
LastModifiedByUser=null,
LastModifiedDateTime=[07/24/2019 06:28:01 +00:00],
ListItem=null,
Location=null,
Name=“office365test”,
ODataType=“#microsoft.graph.driveItem”,
Package=null,
ParentReference=ItemReference
{
AdditionalData=null,
DriveId=“b!VLhl78qaoUyeBE-Wbh7yn-IpR6_Hyq1HivB_NQRu_e0OYoqVF5HXTIlewDj4QVxD”,
DriveType=“business”,
Id=“01O5GMBBP5EV7CVWMVSNCYMYDKTSGQOTOM”,
Name=null,
ODataType=null,
Path=null,
ShareId=null,
SharepointIds=null,
SiteId=null
},
Permissions=null,
Photo=null,
Publication=null,
RemoteItem=null,
Root=null,
SearchResult=SearchResult
{
AdditionalData=null,
ODataType=null,
OnClickTelemetryUrl=null
},
Shared=Shared
{
AdditionalData=null,
ODataType=null,
Owner=null,
Scope=“users”,
SharedBy=null,
SharedDateTime=null
},
SharepointIds=null,
Size=0,
SpecialFolder=null,
Subscriptions=null,
Thumbnails=null,
Versions=null,
Video=null,
WebDavUrl=null,
WebUrl=“Sign in to your account”,
Workbook=null
}
}

Here item.Name will give you the name of the file or folder present in the Drive. Hope this will help you. :slight_smile:

Regards,
Vamsi Nori

1 Like

I tried this and it works, however if there is no folder exist in one drive then it doesnt go into Far Each Loop and so, I cant use IF condition to check whether item.name is same as my folder name. Any suggestion?

if it doesn’t goes to loop it itself means there is no folder named it. if this solution doesn’t help can you please help me with elaborating the question.

Then how do you give the IF condition to find whether that folder in onedrive exist or not, that is my main goal.
Or is there a way to upload folder itself instead of file, since i have multiple files and folder inside main folder.

upload file will upload only files that too of size 4MB if you want to upload files of even bigger size have a look at this URL

uipath doesn’t have direct activity to upload large files as of date.
you can copy files and folders from a drive location to another by this activity

https://integrations.uipath.com/docs/office365-copy-item

my approach for copying folder from one location to drive location is

Send hotkey (Win + R)
type into folder location
click Text (folder name as the input text)
send hotkey (Ctrl +C)
Send hotkey (Win + R)
type into folder destination (this will be drive location)
send hotkey (Ctrl +V)

But i have to upload files in one drive not any folder in the system. Thats why i tried to use office 365 activity. Anyother suggestions?

I will try this and update you. Thank you.

I have mapped onedrive to the machine and just moving folder from local to onedrive and it syncs online. This is the easy way i think.

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