I have created a working VS Code extension. The extension allows someone teaching code to provide students with real-time access to the teacher's code.
I want to add one more feature to the extension to allow the teacher to connect the VS Code extension to an account form a separate web application. The teacher would login to their account on the web application, generate a token, and place that token in the VS Code extension settings.
I have spent hours looking for documentation or examples on how to add settings to a VS Code extension but can't find anything.
Is this possible? Does anyone know how to do this? Or aware of any good documentation/examples?
Yes a little tricky as what you are looking for are configurations - which can be created by an extension and set by a user.
Configuration docs (settings)
Contribute configuration keys that will be exposed to the user. The
user will be able to set these configuration options as User Settings
or as Workspace Settings, either by using the Settings editor or by
editing the JSON settings file directly.
There are examples and extensive docs at that link above.
Here is sample code from an extension I wrote which creates 2 settings:
"configuration": [
{
"title": "Find and Transform",
"properties": {
"find-and-transform.enableContextMenus": {
"type": "boolean",
"scope": "machine",
"default": true,
"markdownDescription": "Show `Search in this File`, `Search in this Folder` and `Search in the Results Files` in the context menus."
},
"find-and-transform.enableWarningDialog": {
"type": "boolean",
"scope": "machine",
"default": true,
"markdownDescription": "Enable a warning dialog if there are bad argument keys or values in settings and keybindings."
}
}
}
]
Maybe you looking for that extension :
https://code.visualstudio.com/learn/collaboration/live-share,
it acts like google docs, with live share.
Related
When creating an Azure Media Services Job via the REST API, I cannot set a presetOverrides property on the JobOutputAsset as defined in the documentation: https://learn.microsoft.com/en-us/rest/api/media/jobs/create#joboutputasset
My request body is:
{
"properties": {
"input": {
"#odata.type": "#Microsoft.Media.JobInputAsset",
"assetName": "inputAsset"
},
"outputs": [
{
"#odata.type": "#Microsoft.Media.JobOutputAsset",
"assetName": "outputAsset",
"label": "en-US",
"presetOverride": {
"#odata.type": "#Microsoft.Media.AudioAnalyzerPreset",
"audioLanguage": "en-US",
"mode": "Basic"
}
}
],
"priority" : "Normal"
}
}
The error message thrown is:
{
"error": {
"code": "InvalidResource",
"message": "The property 'presetOverride' does not exist on type 'Microsoft.Media.JobOutputAsset'. Make sure to only use property names that are defined by the type."
}
}
When removing the presetOverride data, everything works as expected. The official documentation clearly states that the Microsoft.Media.JobOutputAsset does have a presetOverride property though. What am I doing wrong?
It is important to select the correct API version when communicating with the Azure Media Services REST API.
In this case, api version 2020-05-01 from the Azure Media Services Postman examples was used. But the presetOverride option is only available starting with version 2021-06-01.
Setting api-version=2021-06-01 as a GET parameter enables Preset Overrides.
couple of concerns here Rene. I would not recommend using the raw REST API directly for any Azure services. Reason being is that there are a lot of built-in retry scenarios and retry policies that are already rolled into the client SDKs. We've had many customers try to roll their own REST API library but run into massive issues in production because they failed to read up on how to handle and write their own custom retry policy code.
Unless you are really familiar with rolling your own retry policies and how Azure Resource Management gateway works, try to avoid it and just use the official client SDKs - see here - https://learn.microsoft.com/en-us/azure/architecture/best-practices/retry-service-specific#general-rest-and-retry-guidelines
Now, to answer your specific question - try using my sample here in .NET and see if it answers your question.
https://github.com/Azure-Samples/media-services-v3-dotnet/blob/3ab85647cbadd2b868aadf175afdede67b40b2fd/AudioAnalytics/AudioAnalyzer/Program.cs#L129
I can also provide a working sample of this in Node.js/Typescript in this repo if you like. It is using the latest 10.0.0 release of our Javascript SDK.
I'm working on samples in this repo today - https://github.com/Azure-Samples/media-services-v3-node-tutorials
UPDATE: Added basic audio in Typescript sample.
https://github.com/Azure-Samples/media-services-v3-node-tutorials/blob/main/AudioAnalytics/index.ts
Shows how to use the preset override per job.
I would like to share document by link in sharepoint from microsoft graph code. Default behaviour is that every person who has link can see this file. I want to make this link working just for specific people.
So my code look like this:
Permission permission = await _graphClient.Sites[_options.SiteId]
.Drives[driveId]
.Items[itemId]
.CreateLink("view", "organization")
.Request()
.PostAsync();
This create share link for all people in organization. Now I would like to grant permissions (https://learn.microsoft.com/en-us/graph/api/permission-grant?view=graph-rest-1.0&tabs=csharp)
await graphClient.Shares["{sharedDriveItem-id}"].Permission
.Grant(roles,recipients)
.Request()
.PostAsync();
But I have no idea what should be in place "{sharedDriveItem-id}". When I put there itemId it doesn't work. Also if I put there permission.link.webUrl it also doesn't work.
What am I doing wrong?
From this documentation.
Once you create the shared link the response object returns an id, that's what you should use in place of the {sharedDriveItem-id}. See a similar response object below.
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": "123ABC", // this is the sharedDriveItem-id
"roles": ["write"],
"link": {
"type": "view",
"scope": "anonymous",
"webUrl": "https://1drv.ms/A6913278E564460AA616C71B28AD6EB6",
"application": {
"id": "1234",
"displayName": "Sample Application"
},
},
"hasPassword": true
}
Okey, I found solution. There are few steps:
As sharedDriveItem-id I used encoded webUrl following by this instruction https://learn.microsoft.com/en-us/graph/api/shares-get?view=graph-rest-1.0&tabs=http
When I was creating link (https://learn.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0&tabs=http) in place scope i put "users"- there is no option like that in documentation but without that it doesn't work
I added Prefer in header https://learn.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0&tabs=http
I was using clientSecret/clientId authorization so I had to add azure app access to Sites.Manage.All and Sites.FullControl.All in Graph Api Permissions
Everything works If you using Microsoftg.Graph nuget in newest version (4.3 right now if I remember correctly)
We are using Jira in our organization. I'm using Python and rest API/2 to connect with Jira (Server). I wanted to create a project with existing project configuration, I found it using rest API/1. Is there any way to do the same using version 2?
I already checked here:
https://developer.atlassian.com/cloud/jira/platform/rest/v2/
https://community.atlassian.com/t5/Jira-questions/How-to-create-project-with-shared-Configuration-via-REST-API/qaq-p/650062
I'm using requests module in Python.
How to get all the configurations that are made to the project (We will use the below configurations for templates in our organization)?
Issue Type Scheme
Workflow Scheme
Issue Type Screen Scheme
Field Configuration Scheme
Permission Scheme
Notification Scheme
Issue Security
Starting from Jira 7.0.0, we can use Create project REST API which also allows setting following schemes while creating the project,
1.issueSecurityScheme
2.permissionScheme
3.notificationScheme
4.workflowSchemeId
REST Endpoint: [POST /rest/api/2/project]
Sample Request Payload:
{
"key": "EX",
"name": "Example",
"projectTypeKey": "business",
"projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-project-management",
"description": "Example Project description",
"lead": "Charlie",
"url": "http://atlassian.com",
"assigneeType": "PROJECT_LEAD",
"avatarId": 10200,
"issueSecurityScheme": 10001,
"permissionScheme": 10011,
"notificationScheme": 10021,
"workflowSchemeId": 10031,
"categoryId": 10120
}
For issuetype and screen schemes, there is no such parameter available which can be set using the above create project rest api.
If you want to create a new jira project which needs to inherit all the configuration of any existing project(or template project) then use the following Rest endpoint to create jira project using shared configuration which will allow you to reuse all schemes which are present in the template project(existing project).
REST ENDPOINT: POST /rest/project-templates/1.0/createshared/{{projectid}}
Sample Request Payload:
{
"key": "NEWKEY",
"name": "New test project",
"lead": "lead username"
}
You can get the ProjectID of the template project using the below rest endpoint,
GET /rest/api/2/project/{projectIdOrKey}
I have created some Chrome extensions for fun but later I found some app in the chrome://apps/ tab.
I tried to open their manifest.json and find this segment:
"app": {
"launch": {
"web_url": "https://www.***.com/"
},
"urls": [ "https://www.***.com/" ]
},
But I couldn't find any related documentation online.
Is there any reference for this?
Thanks
Yes, it's here. https://developer.chrome.com/apps/about_apps
But you should carefully consider to use this because:
Important: Chrome will be removing support for Chrome Apps on Windows, Mac, and Linux.
I am using this bit of code as an output object in my ARM template,
"[listAdminKeys(variables('searchServiceId'), '2015-08-19').PrimaryKey]"
Full text sample of the output section:
"outputs": {
"SearchServiceAdminKey": {
"type": "string",
"value": "[listAdminKeys(variables('searchServiceId'), '2015-08-19').PrimaryKey]"
},
"SearchServiceQueryKey": {
"type": "string",
"value": "[listQueryKeys(variables('searchServiceId'), '2015-08-19')[0]]"
}
I receive the following error during deployment (unfortunately, any error means the template deployment skips output section):
"The requested resource does not support http method 'POST'."
Checking the browser behavior seems to validate the error is related to the function (and, it using POST).
listAdminKeys using POST
How might I avoid this error and retrieve the AzureSearch admin key in the output?
Update: the goal of doing this is to gather all the relevant bits of information to plug into other scripts (.ps1) as parameters, since those resources are provisioned by this template. Would save someone from digging through the portal to copy/paste.
Thank you
You error comes from listQueryKeys, not admin keys.
https://learn.microsoft.com/en-us/rest/api/searchmanagement/adminkeys/get
https://learn.microsoft.com/en-us/rest/api/searchmanagement/querykeys/listbysearchservice
you wont be able to retrive those in the arm template, it can only "emulate" POST calls, not GET
With the latest API version, it's possible to get the query key using this:
"SearchServiceQueryKey": {
"type": "string",
"value": "[listQueryKeys(variables('searchServiceId'), '2020-06-30').value[0].key]"
}