मैं सी #, Google .NET API का उपयोग कर रहा हूं। मैं Google ड्राइव रूट स्थान में फ़ोल्डर कैसे बना सकता हूं? कोई भी कोड सहायक होगा। धन्यवाद.NET API का उपयोग कर Google ड्राइव में फ़ोल्डर कैसे बनाएं?
5
A
उत्तर
10
एक फ़ोल्डर को एक विशेष एमआईएम प्रकार के साथ फ़ाइल के रूप में माना जा सकता है: "application/vnd.google-apps.folder"।
निम्नलिखित सी # कोड होना चाहिए कि तुम क्या जरूरत है:
File body = new File();
body.Title = "document title";
body.Description = "document description";
body.MimeType = "application/vnd.google-apps.folder";
// service is an authorized Drive API service instance
File file = service.Files.Insert(body).Fetch();
अधिक जानकारी के लिए डॉक्स की जाँच करें: https://developers.google.com/drive/folder
0
//First you will need a DriveService:
ClientSecrets cs = new ClientSecrets();
cs.ClientId = yourClientId;
cs.ClientSecret = yourClientSecret;
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
cs,
new[] { DriveService.Scope.Drive },
"user",
CancellationToken.None,
null
).Result;
DriveService service = new DriveService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "TheAppName"
});
//then you can upload the file:
File body = new File();
body.Title = "document title";
body.Description = "document description";
body.MimeType = "application/vnd.google-apps.folder";
File folder = service.Files.Insert(body).Execute();
0
Google डिस्क API में, किसी फ़ोल्डर के अलावा कुछ नहीं माइम के साथ एक फ़ाइल है प्रकार: application/vnd.google-apps.folder
API v2 में, आप उपयोग कर सकते हैं:
// DriveService _service: Valid, authenticated Drive service
// string_ title: Title of the folder
// string _description: Description of the folder
// _parent: ID of the parent directory to which the folder should be created
public static File createDirectory(DriveService _service, string _title, string _description, string _parent)
{
File NewDirectory = null;
File body = new File();
body.Title = _title;
body.Description = _description;
body.MimeType = "application/vnd.google-apps.folder";
body.Parents = new List<ParentReference>() { new ParentReference() { Id = _parent } };
try
{
FilesResource.InsertRequest request = _service.Files.Insert(body);
NewDirectory = request.Execute();
}
catch(Exception e)
{
MessageBox.Show(e.Message, "Error Occured");
}
return NewDirectory;
}
रूट निर्देशिका में फ़ोल्डर बनाने के लिए, आप मूल आईडी के रूप में "root"
पास कर सकते हैं।
संबंधित मुद्दे
- 1. फ़ोल्डर बनाएं यदि यह Google ड्राइव
- 2. Google ड्राइव एपीआई - फ़ोल्डर पथ प्राप्त करें
- 3. Google ड्राइव फ़ोल्डर हटाना व्यवहार
- 4. Google ड्राइव
- 5. जावा डेस्कटॉप ऐप में Google ड्राइव का उपयोग कैसे करें?
- 6. Google ड्राइव API उपयोग की सीमा क्या है?
- 7. एंड्रॉइड में Google स्थल API का उपयोग
- 8. Google Analytics API और .Net
- 9. एक पायथन लिपि का उपयोग कर Google ड्राइव में फ़ाइल कैसे अपलोड करें?
- 10. .NET में XmlWriter का उपयोग कर XmlDocument कैसे बनाएं?
- 11. Google ड्राइव एपीआई प्रमाणीकरण
- 12. .tt टेम्पलेट का उपयोग कर फ़ोल्डर कैसे बनाएं?
- 13. Google ड्राइव एपीआई
- 14. Google ड्राइव
- 15. ड्राइव एपीआई जावा का उपयोग कर Google ड्राइव से फ़ाइल कैसे डाउनलोड करें?
- 16. Google ड्राइव
- 17. मैं सी # का उपयोग करके अपने Google ड्राइव फ़ोल्डर को प्रोग्रामेटिक रूप से कैसे ढूंढूं?
- 18. Google- drive-api
- 19. Google ऐप्स स्क्रिप्ट: Google ड्राइव में फ़ाइल को कैसे हटाएं?
- 20. Google कैलेंडर API
- 21. Google ड्राइव
- 22. कोडइग्निटर में Google Map API का उपयोग कैसे करें?
- 23. Google ड्राइव एपीआई (जावा क्लाइंट)
- 24. विजुअल स्टूडियो का उपयोग कर .NET स्वतंत्र ऐप्स कैसे बनाएं?
- 25. आईओएस: Google ड्राइव एसडीके लाइब्रेरी
- 26. Android ऐप्स में Google ड्राइव का एकीकरण?
- 27. .NET API?
- 28. Google ड्राइव एपीआई वी 2, पायथन - नई फ़ाइल अपलोड किए बिना और Google ड्राइव यूआई
- 29. Google ड्राइव एसडीके वी 2
- 30. Google मानचित्र: Google मानचित्र API v3 का उपयोग करके मानचित्र
मैं फ़ोल्डर बनाने में सक्षम नहीं हूं और कोई त्रुटि भी प्राप्त नहीं हुई है। इसके अलावा। फ़ेच() विधि मेरे लिए नहीं आ रही है? ड्राइव सेवा को तुरंत कैसे चालू करें? मैं इसका उपयोग इस ड्राइव सेवा डीएस = नई ड्राइव सेवा(); ds.Key = PicasaAuthToken; धन्यवाद। – Sujit
प्रमाणीकरण (https://developers.google.com/drive/apps_overview) को निष्पादित करने के तरीके के बारे में जानने के लिए दस्तावेज़ों की जांच करें, एक Picasa ऑथ टोकन ड्राइव के साथ मदद नहीं करता है। –