You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm new to the msgraph-sdk-python library. After logging in with a corporate user to provision OneDrive, I am able to see a page of my corporate that I believe is OneDrive for Business but the url and the page seems like a sharepoint library. The url format is:
corporatename-my.sharepoint.com/my under "My Files" tab.
I tried creating a folder named "test".
Now I wish to use the SDK, for instance, to do the following tasks:
to see the folder, create a new folder, list files, upload/download a file, and convert a .docx into a .pdf
My attempt so far is something like this:
class OneDriveDAO:
def __init__(self):
self.client = GraphClientSingleton.get_client()
self.user_id: str = myuser_id
self.drive_id: str = mydrive_id
# GET /users/{user-id}/drives
async def list_drives(self, user_id: Optional[str] = None):
if user_id is None:
user_id = self.user_id
drives = await self.client.users.by_user_id(user_id).drives.get()
if drives and drives.value:
for idx, drive in enumerate(drives.value):
print(f"{idx}: id={drive.id}, type={drive.drive_type}, name={drive.name}, description={drive.description}, url={drive.web_url}")
return drives.value
and I am able to properly see two Drives object, one is named "OneDrive", the other is named "PersonalCacheLibrary".
I selected the id of the "OneDrive" Drive, and now I am trying to list or create a new folder without success.
The problem is that when I get the drive by its id, the returned object have the root, items, and other attributes set to None, and I am not able to chain the desired methods.
I don't know what to try
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm new to the msgraph-sdk-python library. After logging in with a corporate user to provision OneDrive, I am able to see a page of my corporate that I believe is OneDrive for Business but the url and the page seems like a sharepoint library. The url format is:
corporatename-my.sharepoint.com/my under "My Files" tab.
I tried creating a folder named "test".
Now I wish to use the SDK, for instance, to do the following tasks:
to see the folder, create a new folder, list files, upload/download a file, and convert a .docx into a .pdf
My attempt so far is something like this:
and I am able to properly see two Drives object, one is named "OneDrive", the other is named "PersonalCacheLibrary".
I selected the id of the "OneDrive" Drive, and now I am trying to list or create a new folder without success.
My tries:
The problem is that when I get the drive by its id, the returned object have the root, items, and other attributes set to None, and I am not able to chain the desired methods.
I don't know what to try
Beta Was this translation helpful? Give feedback.
All reactions