vb.net - Share a document with specified user in Google Drive -


i want share file exists in google drive specified user. file not public.

firstly, want show file in webbrowser control. secondly, want when share url different user, can show file in google drive.

here code, can first step second step, don't know how can it.

public sub a(fichier string)  createservice()     dim url string = ""     dim list = service.files.list()     dim count = list.execute()     each fich in count.items         if (fich.title) = fichier             url = fich.webcontentlink             exit         end if     next     affich_image.img.navigate(url)     affich_image.show() 

you can use permissions.insert method.

inserts permission file or team drive.

to see parameters , further details, try visit documentation.

here, provide sample code .net introduced in said documentation.

using google.apis.drive.v2; using google.apis.drive.v2.data;  using system.net; // ...  public class myclass {    // ...    /// <summary>   /// insert new permission.   /// </summary>   /// <param name="service">drive api service instance.</param>   /// <param name="fileid">id of file insert permission for.</param>   /// <param name="value">   /// user or group e-mail address, domain name or null "default" type.   /// </param>   /// <param name="type">the value "user", "group", "domain" or "default".</param>   /// <param name="role">the value "owner", "writer" or "reader".</param>   /// <returns>the inserted permission, null returned if api error occurred</returns>   public static permission insertpermission(driveservice service, string fileid, string value,       string type, string role) {     permission newpermission = new permission();     newpermission.value = value;     newpermission.type = type;     newpermission.role = role;     try {       return service.permissions.insert(newpermission, fileid).execute();     } catch (exception e) {       console.writeline("an error occurred: " + e.message);     }     return null;   }    // ...  } 

you may visit so post further discussion.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -