Creating realtime document for a folder - google-drive-realtime-api

I'd like to create a realtime model holding the name, description and some other properties for a drive folder.
When I try to create the realtime document with the folder id I get a "Bad request".
Is creating realtime models for folders supported?

Related

Logic Apps SharePoint Connector - When a file is created or modified in a folder

I have an integration scenario where I need to pull documents from SharePoint Online and submit the content (PDF) to a downstream API. I'm using the When a file is created or modified in a folder trigger to pull documents from a SharePoint library. My question is whether there is a way to set a filter on the trigger so that only PDF documents are retrieved i.e. (*.pdf)?
For this requirement, you can click "Settings" of your trigger.
And then add the expression #contains(triggerBody()?['{FilenameWithExtension}'], '.pdf') to "Trigger Conditions".
After that, the logic app can just be triggered with file name which contains .pdf.
=================================Upate==============================
You can change the expression to:
#contains(trigger().outputs?['headers']?['x-ms-file-name'], '.pdf')

Auto creation of entities in blobuploadsession datastore when using upload to url functionality in blob datastore

I'm wondering if deletion of these entities in blobuploadsession would affect my app functionality or performance in any which way. The reason for deletion is when a new form is created and there were no files that were uploaded to, then it results in unnecessary entities being created.
(edit: additional info from comment)
I use blobstore (part of NDB) to store images asynchronously via upload URL functionality. When I run the app on localhost, there is an auto-creation of a datastore called "BlobUploadSession". This is the entity where all the URLs for the images to be uploaded are stored as entities. When I upload a photo to the URL, it goes into the "BlobInfo" datastore. Now, I don't have a need of the URLs since the photo has already been uploaded. So, I'm wondering if I can delete the BlobUploadSession entities? Btw, BlobUploadSession and BlobInfo are default datastores automatically created.
The __BlobUploadSession__ and __BlobInfo__ entities are created by and only internally used by the development server while emulating the blobstore functionality.
There are others, similarly named __SomeEntityName__ entities for emulating other pieces of functionality, for example a pile of them are created when you're requesting datastore stats (such function doesn't exist per-se in production).
These entities aren't created on GAE, so no need to worry about them in production.
See also related How to remove built-in kinds' names in google datastore using kind queries

Why is saveAs failing from read-only file?

My application uses the google realtime API to define a custom document type, and includes a feature that allows you to create a copy of a document, using the API's document.saveAs. One purpose of this is to allow users to make and edit personal copies of document templates that have been shared with them as read-only files. I create a new document then use saveAs to copy the realtime document into it, something like this:
gapi.client.drive.files.create({
resource: {
mimeType: 'application/vnd.google-apps.drive-sdk',
name: NEWNAME
}).then((response) => {
MYDOCUMENT.saveAs(response.result.id);
});
This works perfectly with read-write files, but if the original file is read only it does not appear to save the realtime document into the new file. No error is reported but the resulting new file is empty.
Is this is a bug or known limitation, or am I doing something wrong?
You may want to check Collaborators and sharing wherein it was stated that the Realtime API uses Google Drive to manage permissions and sharing.
Reading further,
Access to files & folders is determined by an access control list (ACL). An ACL is a list of permissions that determine whether or not users can perform actions on a file such as read or write. See the permissions guide for additional details about permissions and roles.
The role gives these users the ability to do something to the file, like read it. As far as I've read, here are the permitted operations for read-only:
Read the metadata (e.g. name, description) of the file or folder
Read the content of the file
Read the list of items in the folder

how to duplicate a file field entry from drupal commerce to another field so it can be previewed

Im looking for a way to copy a file being uploaded to drupal commerce using commerce file/license to another file field in drupal 7. I want to preview audio files being sold on drupal commerce but because of the private file structure that is forced by commerce license, I have to duplicate the file to another field that is public.
Is there a way to copy a file being uploaded to a public directory and also add a database entry for an additional field associated to the content type?
Basically you have to create a "public mirror" of the file you uploaded.
Not digging to much in code, since commerce_product is an entity we assume we can alter the product whenever it is saved, so you can to as follow:
create a module and use hook_entity_insert and/or hook_entity_update
find the file you need, make a public copy
fill the value of the public file in another field of the same entity

what's best way to store photo/video

I am developing app which will let user to upload his/her photos/videos.
I thought of some ways to do it.
1) Store image in mysql (I am not sure about videos)
2) store images and videos in separate folder and give path of that image/video in database table against owner of image/video.
3) Create separate directories for all the users and store directly into directory and assign that path to database against owner of the image/video.
which of these is best to use for mobile app ?
Any Help would appreciated.
The best approach would be to store your multimedia files into any object storage service(Amazon S3 for example) and store their relative path along with the file name in the database

Resources