Google Drive: where are my comments? - google-api

The Google API does seem to permit to create comments and replies on any type of files (including binary files)
Also, I can publicly share a link and grant anonymous users having the link the permission to view and comment this file. This is the case of this picture with id=0BxMiPUSrDs2EMWVUQkR3cWsxRWs, yet, browsing this url as an anonymous user, I don't really know where are the comments and how to send a new comment.
Using this Drive API, I successfully created a comment:
POST https://www.googleapis.com/drive/v3/files/fileId/comments
Using this Drive API, I successfully listed the file comments:
GET https://www.googleapis.com/drive/v3/files/fileId/comments
Result is:
{
"comments": [
{
"kind": "drive#comment",
"id": "AAAAA-ZIom0",
"createdTime": "2017-03-28T17:21:18.008Z",
"modifiedTime": "2017-03-28T17:21:18.008Z",
"author": {
"kind": "drive#user",
"displayName": "Sébastien Lorber",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": true
},
"htmlContent": "Hello world",
"content": "Hello world",
"deleted": false,
"resolved": false,
"replies": []
}
]
}
So it seems this file does have a comment.
The problem is that, when using both the Drive web UI, and the Drive Android application, I am totally unable to access the content of this comment.
I can only see the comment appears as an entry inside the file activity log, so the Drive UI does know that there is a comment, but I am totally unable to find a way to read the comment content Hello world inside the official UIs.
So: am I missing something, or the Drive comment system is only to be considered as a SaaS backend for comments and the official UIs do not care of the comments we created (unless they are special kind of files, like Google Docs files).
Is there any Drive application out there that actually does show Drive comments for any kind of file?

Google Drive Comments:
View all comments:
Open a document, spreadsheet, or presentation.
In the top right, click Comments.
To close, click Comments again.
This issue is in how Google Drive works. Google drive only displays comments for the following types of files document, spreadsheet, or presentation.
While the API may allow you to add a comment Drive wont display it.

These comments should now be shown directly in the Drive UI: https://gsuiteupdates.googleblog.com/2018/02/comment-on-files-in-drive-preview-mode.html

Related

Send pdf with smba trafficmanager or botframework

I'm trying to send pdf file as attachment proactively to teams user with https://smba.trafficmanager.net/in/v3/conversations/ and attachment format as below
"attachments": [
{
"contentType": "application/pdf",
"contentUrl": "http://www.africau.edu/images/default/sample.pdf",
"name": "sample.pdf",
"content": {
"uniqueId": "1150D938-8870-4044-9F2C-1213213123",
"fileType": "pdf"
}
}
]
I'm able to send txt files but not pdf, every time I'm getting
{"error":{"code":"BadArgument","message":"Unknown attachment type"}}
Is there any other contentType other than application/pdf ?
I agree with Hilton and Dev here. I think it's more convenient to post messages with card attachments referencing existing SharePoint files using the Microsoft Graph APIs.
MS documents referred to 2 ways for bots send attachment. Using the Microsoft Graph APIs works for bots in all scopes in Teams while using the Teams APIs works only in the personal context.
By the way, the document says pdf is ok to be a file type.
#kiran, The below payload works for me. So i am adding the payload for your convenience (below), so that you can copy/test it.
{ "body": { "contentType": "html", "content": "Here's the latest budget. <attachment id=\"153fa47d-18c9-4179-be08-9879815a9f90\"></attachment>" }, "attachments": [ { "id": "153fa47d-18c9-4179-be08-9879815a9f90", "contentType": "reference", "contentUrl": "m365x987948.sharepoint.com/sites/test/Shared%20Documents/…", "name": "Budget.pdf" } ] }
Based on the discussion in the comments, it is definitely better to rather provide a link to the document, hosted in SharePoint (files tab) - that's exactly what the Files tab is intended for, rather than every user having to download their own copy. In addition, have a look at the topic of Link Unfurling to see how to provide a better embedded experience for the posted file.

Adaptive Card Action.OpenUrl not working for certain URLs in Microsoft Teams bot

I am working on a Microsoft Teams chat bot using Microsoft Bot Framework. The bot sends an Adaptive Card containing some text and the following Action:
{
"type": "ActionSet",
"actions": [
{
"type": "Action.OpenUrl",
"title": "View in dashboard",
"url": "${url}"
}
]
},
The URL is of the following form (edited to remove identifying info):
https://internaldomain.net/dashboard/share/134590h9?overrides=[{"query":"//dataSources","key":"account","replacement":"accountName"},{"query":"//*[id='Cluster']","key":"value","replacement":"clusterId"},{"query":"//*[id='NodeId']","key":"value","replacement":"nodeId"},{"query":"//*[id='ContainerId']","key":"value","replacement":"containerId"}]&globalStartTime=1591552800000&globalEndTime=1592460000000&pinGlobalTimeRange=true
The URL is generated and passed into the url property using a JSON templating library, and I can print the URL in the console so I know it is set properly. Also, I can run the bot in the Emulator and open the link that way. However, when I run the bot in Teams and try to open the same exact link by clicking the action button, nothing happens. If I change what URL is passed in, e.g. using https://internaldomain.net/dashboard, the link works correctly.
One thought is that the generated URL is formatted improperly so Teams doesn't recognize it or open it. But I can paste it into a browser and it opens properly.
Another thought is that the URL length (almost 500 chars) exceeds some limit for Adaptive Cards, but I haven't been able to find any info about that in the documentation or online.
I would appreciate any other ideas about what might be causing this.
Thanks!
It looks like you're needing to encode the urls before embedding them - probably the {"query" etc. is conflicting with the final Json. It looks like you're using .Net, so you could call WebUtility.UrlEncode, on everything from "?" onwards (i.e. "?overrides...")

Your first extension - official Firefox extension tutorial not working

I wanted to try learning how to make a browser extension and tried doing the first official tutorial https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension
When following everything here and going into a mozilla.org domain the extension does not put a red border around the site. It basically does nothing. (I know that content scripts are disabled on addon.mozilla.org)
I've carefully followed each step of the tutorial.
Here's the repository for the tutorial : https://github.com/mdn/webextensions-examples/tree/master/borderify
I just want to verify if I'm the only one with who this tutorial does not work.
The tutorial is fine. You can try changing it to another site and test again. For example:
{
"description": "Adds a solid red border to all webpages matching mozilla.org. See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Examples#borderify",
"manifest_version": 2,
"name": "Borderify",
"version": "1.0",
"homepage_url": "https://github.com/mdn/webextensions-examples/tree/master/borderify",
"icons": {
"48": "icons/border-48.png"
},
"content_scripts": [
{
"matches": ["*://*.example.com/*"],
"js": ["borderify.js"]
}
]
}
Then go to https://example.com/ to test.
I had the same problem: the Borderify example was not working. In my case, it was a problem of my default browser's privacy settings.
Try going to Firefox settings and see if the option Always use private mode is disabled.
Alternatively, after loading the extension in debugging mode, go to the Add-Ons section and enable the extension for private windows.

Grant Google App Maker Full Google Drive API Scope / Server Rejected Error

I have an app maker application using the Google Drive File picker widget. But uploading files does not work, I get a server rejected error.
API Upload Response
{
"errorMessage": {
"reason": "REQUEST_REJECTED",
"additionalInfo": {
"uploader_service.GoogleRupioAdditionalInfo": {
"completionInfo": {
"status": "REJECTED"
},
"requestRejectedInfo": {
"reasonDescription": "agent_rejected"
}
}
},
"upload_id": "UrqXRaPdnG_DZ0L-iDX5BJsG4XEg"
}
I believe the issue is the app's oauth scopes. It appears to only have read access which is insufficient for uploading new files.
I'd like to grant it full access https://www.googleapis.com/auth/drive but I'm not clear how to do this.
This behavior is a bug and it has been recently introduced as far as I'm aware. To be honest, the full drive scope should be granted when enabling the simple uploads feature in the drive picker but some reason it is not doing it. As a work around, you can put the following in any server script:
/***
Dummy function for drive full permissions
****/
function dummyForDrivePermission(){
var file = DriveApp.addFile();
}
The above code, will force appmaker to recognize that it needs to upload files, although you will never invoke the function but it will server the purpose of granting the scope you need.

How to send a local file path thorugh the QnA Create Knowledgebase API?

I am referring to this QnA create knowledgebaseAPI documentation. I want to upload the knowledge base through the Excel file which is stored in the local path. I don't have URL for the excel file, only the local path.
I followed the code given on github link, I removed the unnecessary things and kept the variable "kb" as shown below:
static string kb = $#"
{{
'name': 'VivekKB',
'qnaList': [],
'urls': [ ],
'files': [
'files': {{DBFile}}
]
}}
DBFile is the filename with full path. When I run the code, it creates an Empty knowledge store. It doesn't upload the excel file which I mentioned. Can you please help me to figure it out how to upload a local excel QnA data directly to QnA store. I want to avoid manual uploading excel to knowledgebases at https://www.qnamaker.ai.
Thanks in advance.
Vivek
Connected with the QnA team directly, asking the following:
Question: Is it possible to use a local file path to create KB through the programmatic API?
I know given in the programmatic QnA API docs it demonstrates how to add a PDF file that’s already also available online as well:
"files": [
{
"fileName": "SurfaceManual.pdf",
"fileUri": "https://download.microsoft.com/download/2/9/B/29B20383-302C-4517-A006-B0186F04BE28/surface-pro-4-user-guide-EN.pdf"
}
However when I tried using “POST Create Knowledgebase “ in Postman using the relative file path in the “fileUri”, I get “invalid uri” error.
Request Body
{
"name": "Simple QnA",
"files": [
{
"fileName": "simpleQnaSource.docx",
"fileUri": "C:\\Users\\v-asho\\Documents\\RandomWordDocs"
}
]
}
Response
{
"error": {
"code": "BadArgument",
"message": "Invalid input. See details.",
"details": [
{
"code": "ValidationFailure",
"message": "File Uri has one or more invalid uri.",
"target": "Files[0].FileUri"
}
]
}
}
Uploading the .docx file online through qnamaker.ai portal successfully creates a KB, it’s specifically through the programmatic api where I’m having issues.
QnA Team's Answer:
“fileUri” can have a publicly available and downloadable URI as value.
When using it via API, please upload the contents of local file to a publicly available domain. (Example: Azure storage blob shared to public).

Resources