I can create a Google Doc, but whenever I try to access the link I get a permission denied notice. Is there a way to make the document public to anyone who has a link with the ruby client api?
Thanks!
The code at https://developers.google.com/drive/v2/reference/permissions/insert shows how to add new permissions to a document using Ruby.
To make the documents available to everyone, you have to set the permission type to anyone.
Related
My android app needs to access (read only) .txt file located on OneDrive. Which is the simplest way to achieve that? All tutorial I read are a bit complicated for me (I'm new in this android stuff).
The simplest way is to share the file read only using “anyone anonymous with the link”. So basically no log in is required to access the file, just the link generated by onedrive. Using that link you should be able to access the file directly like any http web link.
Cheers
Christian
I have a written code to rename files of onedrive logged in user, using graph api with following call.
www.graph.microsoft.com/v1.0/me/drive/items/{FileOrFolderID}
with body:
{
"name":"newfilename.txt",
"#name.conflictBehavior": "rename"
}
I'm not able rename the files which has been shared by some other onedrive user with me, which I can if done in browser. The other user has given me editable permissions.
I have tried following syntax to rename file shared with me, but it gives me access denied error.
www.graph.microsoft.com/v1.0/me/drives/{DriveId}/items/{FileOrFolderID}
Can someone please answer what thing I am missing.
A couple of things to try:
Make sure you're requesting Files.ReadWrite.All if you need to modify someone else's items
Try hitting https://graph.microsoft.com/v1.0/drives/{DriveId}/items/{FileOrFolderID}. Using "me" may work, but it's semantically weird.
If neither of those work please update your question to include the full response so we can debug further.
Maybe you can try the character as follow, the full description refer to Update DriveItem properties
This example renames the DriveItem resource to "new-file-name.docx".
PATCH /me/drive/items/{item-id}
Content-type: application/json
"name": "new-file-name.docx"
Regards,
Leon
I try to make integration with OneDrive, using the API https://dev.onedrive.com/getting-started.htm
I make auth work and i can get list of drives in the account .
When i execute the API call /me/drives i am getting the list of drives fine.
But i can not find how to get list of folders on a drive, subfolders of a folder etc.
From the docs i can see there are some API for this, but it doesn't work for me.
https://dev.onedrive.com/items/list.htm
I have to execute on of.
GET /drive/items/{item-id}/children
GET /drive/root:/{item-path}:/children
But it doesn't work. I have a Drive ID from a list of drives. When i execute
GET /drive/items/DRIVEID/children
i have error "Access denied. You do not have permission to perform this action or access this resource."
How to do this operation? should i use a drive ID or name? maybe the url is wrong, what must be the correct url if i have a drive name, ID ?
I have found how to do this. To understand i had to install some other tool where OneDrive API is used and debugged traffic with a https sniffer.
So, if endpoint is https://graph.microsoft.com/v1.0/me/
then paths are
/drives/DRIVEID/root/children
for root of drive
/drives/DRIVEID/root:myfolder/subfolder:/children
for a folder myfolder/subfolder
Final url is like
https://graph.microsoft.com/v1.0/me/drives/DRIVEID/root:myfolder/subfolder:/children
/drive is a shortcut for saying /drives/<driveidofcaller>. When you're attempting to query someone elses drive you'd want /drives/DRIVEID, and so extending to your example you'd want something like:
GET /drives/DRIVEID/root/children
I've built an integration using the Google Docs API (using GData) allowing users to create/edit documents from another application. Originally, when documents were deleted we would have them permanently deleted. They were no longer visible in Google Docs or Google Drive. Now when they are deleted using the Google Docs API, they are still present in the list of Documents in Google Drive. When you attempt to follow the link to the document you arrive at the "Sorry, the page (or document) you have requested does not exist." page.
Does Google Drive not honor the actions taken via the Google Docs API? Do I need to delete these documents using both the Google Docs API and the Google Drive API? What if the user has not migrated to Google Drive? Is there a way to tell if the have migrated? Or do I force them to migrate so I can use the Google Drive API to keep their Google Drive clean of these dead documents?
The Drive API and the Docs List API both operate on the same resources so you only have to use one of them (and we recommend the former).
With the Drive API you can trash or delete files. When you trash a file, it will still be listed in Google Drive with a label to mark it as in trash, so that you can still untrash it.
If you want to remove a file completely, you have to use the delete method.
I was having the same problem and I believe this is some kind of caching on the drive UI.
The file does appear to be deleted correctly and is not visible to the drive API.
The orphaned stubs eventually get deleted as the cache is cleared every so often.
I found that by removing the file from the parent and then deleting it meant that it was easier to see what was going on when using the drive UI whilst testing my app.
service.children().delete(folderId=parent_id, childId=file_id).execute()
service.files().delete(fileId=file_id).execute()
I was facing the same problem while using Google Drive APIs. I think when the Delete api deletes the document, their is still some linking with parent folder remains, so the browser renders the document. when I tired to delete the document with below piece of code, it properly works for me.
DriveService.Childern.Delete(parentResId, fileId).Fetch(); // fileId=>ResourceId of document to be deleted
This is a caching issue, the file has actually been removed. If you try to open the file in the Drive UI you should see something along the lines of "Sorry, the file you have requested does not exist."
It will clear itself soon.
In my app I want users to be able to associate a file(s) they have on their desktop/DropBox with a specific item, but I don't want/need them to be able to actually attach the file...I just want to get the file name and location and save that in my database. Then when I display the item I'll hyperlink to the location captured. Can someone point me to an example(s) of how to accomplish this? I looked at the JQuery File Upload (http://blueimp.github.com/jQuery-File-Upload/) but as I mentioned don't actually need to upload the file...so this should be something super easy.
Thanks for your time and assistance.
You can try and get value of file input, but you'll fail.
See this jsfiddle.
All I'm getting is the fake path
C:\fakepath\134.png
And there's certainly no C:\ drive on Mac OSX. :)
I guess, this is because of security restrictions. You shouldn't know (or care) about user's filesystem in a web app.