When searching files in OneDrive for Business, the path of the parentReference is empty. Is there any reason for this limitation?
Example in MS Graph explorer:
GET https://graph.microsoft.com/v1.0/me/drive/root/search(q='finance')?select=name,parentReference
snippet from result:
"value": [
{
"#odata.type": "#microsoft.graph.driveItem",
"name": "CR-227 Product Overview.pptx",
"parentReference": {
"driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
"driveType": "business",
"id": "01BYE5RZ6TAJHXA5GMWZB2HDLD7SNEXFFU",
"path": "/path/to/folder" <--- THIS IS MISSING
}
},
I would be glad if the path is returned because I need it. Otherwise I need to add additional overhead to query for the parent's paths.
Related
I am using a Blazor app with the Monaco editor. I use the SetValue() and GetValue() methods to write and read the content of the editor, which is working fine in most cases.
However, if there is a lot of data in there, then Blazor gets a timeout when GetValue() is called. I am reading in a JSON file, so I could remove some lines, and at some point, it is working fine again.
This is the code I am using to read the content of the editor:
string userRequirementsJson = await UserRequirementsEditor.GetValue();
The data that is in the editor is pasted below. It goes on for about 2000 lines, so I removed most of it.
[{
"feature": "<redacted>",
"path": [],
"priority": 9999
}, {
"feature": "<redacted>",
"path": [],
"priority": 9998
},
...
, {
"feature": "<redacted>",
"path": [],
"priority": 9996
}, {
"feature": "<redacted>",
"path": ["<redacted>", "<redacted>"],
"priority": 9999
}]
Does anyone know why it is possible to read around 1000 lines, but not 2000? And how can I fix this? Thanks in advance.
I am trying to use environment variables within task in my tasks.json file of a C# project in vscode.
In my launch.json file I have this code to parse a .env file:
"configurations": [
{
...
"envFile": "${workspaceFolder}/.env",
}
]
I then have in the tasks.json file this task:
{
"label": "login",
"command": "sh",
"type": "shell",
"args": [
"${workspaceFolder}/etc/login.sh",
"${env:USERNAME}",
"${env:PASSWORD}"
]
}
This seems to be the code that's implied from https://code.visualstudio.com/docs/editor/tasks, however (from testing by echoing in another task) I have found these last two args to be blank. After researching online I think I have found the reason, the configurations..env is used by the tasks themselves rather than being accessible by task.json that run and so can't be accessed.
How do I create (use) these env variables within the tasks.json?
Checkout https://code.visualstudio.com/docs/editor/tasks-appendix
/**
* The environment of the executed program or shell. If omitted
* the parent process' environment is used.
*/
env?: { [key: string]: string };
example
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "diagnostic",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/beam",
"env": {
"FOO": "baz",
}
},
"command": "printenv",
"problemMatcher": []
}
]
}
There is no way I am aware of to pull these from a file like with launch.json
I would open an issue on the vscode repo
I had the same problem.
I am using Windows.
I was able to fix it.
The issue for me was, in VSCode I had this setting set:
"terminal.integrated.automationShell.windows": "C:/Program Files/Git/bin/bash.exe"
And this was causing the env to not load properly.
I was able to access the windows settings, that you would set from that windows GUI env variable tool. But I could not access env variables set in my .bashrc.
I commented out that setting.
I also have the Terminal > Integrated > Default Profile: Windows
set to Git Bash.
With these changes, I was able to access env variables in my .bashrc file.
I need help with Microsoft GraphAPI.
I want to create folder in SharePoint Online Site Collection, in Document Library, but i get Error.
I Have Site Collection, name A,
in this Site Collection i have Document Library, name XY
I have tried to create Folder using this
POST /sites/{site-id}/drive/items/{parent-item-id}/children
https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_post_children?view=odsp-graph-online
But i always get error, 400 Bad Request.
.../v1.0/sites/tenantName,1a2b3f27-0d23-4b68-8e71-fe06cbfed6b4,5e911195-1934-42a3-814c-86ab8ec2699c/drive/items/b!Jz8rGiMNaEuOcf4Gy_7WtJURkV40GaNCgUyGq47CaZwdNH0_zurqQ6XWJreCPMnF/children";
Error message is, "The expression is not valid".
What am I doing wrong?
It seems that you are using driveId as the parent-item-id. The parent-item-id looks like 01KC572RLYVJZL5JE4ANCLOTQKQMIKYVHL
You can get the parent-item-id by using
GET /sites/{site-id}/drive/root/children
If you get nothing from this request, you should create a folder under the root directory first.
POST /sites/{site-id}/drive/root/children
{
"name": "New Folder222",
"folder": { },
"#microsoft.graph.conflictBehavior": "rename"
}
I am creating a small window form application which will return list of videos based on query. I am using this link https://developers.google.com/youtube/v3/code_samples/dotnet Everything is working fine except for the issue that if embedding is disabled by owner of some video then I am getting an error while trying to play the video that:
"Watch this video on youtube. Playback on other websites has been disabled by the video onwer".
So now I have two questions
1) Is there any way to play that video?
2) IF anwser of the first question is no then how can I filter those videos whose embedding has been disabled by it's owner. Means I don't want to add those videos in my list.
Thanks.
According to official documentation every video has status.embeddable property, which you can check in your code.
The status.embedabble, regardless of language used, is a response anytime one of the methods used in Videos reference is successfully called.
So I would suggest using the method list for example. To demonstrate, I place a youtube video in this videos.list Try-it and place "status" as part parameter.
And true enough I get the embedabble status:
"items": [
{
"kind": "youtube#video",
"etag": "\"7991kDR-QPaa9r0pePmDjBEa2h8/7NFYOO88j54fU9aKM8MsjN4zPro\"",
"id": "kIBdpFJyFkc",
"status": {
"uploadStatus": "processed",
"privacyStatus": "public",
"license": "youtube",
"embeddable": true,
"publicStatsViewable": true
}
}
]
Thanks for all the answers. After exploring the documentation I finally found the solution to filter those videos whose embedding is disabled by the owner.
There is VideoEmbeddable property of YoutubeService.Search.List method which expects Google.Apis.YouTube.v3.SearchResource.ListRequest.VideoEmbeddableEnum can do the trick.
var searchListRequest = youtubeService.Search.List("snippet");
searchListRequest.Q = ""; // Replace with your search term.
searchListRequest.MaxResults = 50;
searchListRequest.Type = "video";
searchListRequest.VideoEmbeddable = SearchResource.ListRequest.VideoEmbeddableEnum.True__;
Specifying a type "video" only returns video insteal of all videos, playlists and channels.
I am trying to get a theme for Visual Studio Code working to what I want. Currently, I'm trying to use Obsidian working with C# rules, but I'm not sure which key word to use to override color customizations. VSCode does not seem to recognize interfaces as they're language specific.
"editor.tokenColorCustomizations": {
"functions" :{
"foreground": "#F1F2F3"
},
"interface": { //not valid
"foreground": "#B48C8C"
}
}
How can I get VSCode color customizations to recognize c# specific syntaxes?
editor.tokenColorCustomizations can use a number of values: comments, functions, keywords, numbers, strings, types and variables. If none of those work for you textMateRules is available as well. So you can do something like:
"editor.tokenColorCustomizations": {
"textMateRules": [{
"scope": "yourScopeHere",
"settings": {
"fontStyle": "italic",
"foreground": "#C69650"
}
}]
},
So you just have to figure out what scope you need for "interface".
For that, try CTRL-Shift-P and type scope: choose
Developer: Inspect Editor Tokens and Scopes
and for whichever keyword is selected, like interface you will get a listing of its textmate scope. That should be inserted as the scope value above. [In my experience, it is more accurate to open the "Inspect TM Scopes" panel and then click a couple of items and then the one, like interface, that you want - the scope panel will remain open.] You can copy from the scopes panel.
You may need only the main scope listed, but if need to narrow its scope you can include the others listed in a comma-separated list in the scopes: ..., ..., ...
Based on Davi's answer:
Edit "C:\Program Files\Microsoft VS Code\resources\app\extensions\csharp\syntaxes\csharp.tmLanguage.json":
Find:
{"name":"storage.type.cs","match":"#?[[:alpha:]][[:alnum:]]*"}
Replace with:
{"name":"storage.type.interface.cs","match":"#?[I][[:upper:]][[:alpha:]][[:alnum:]]"},{"name":"storage.type.cs","match":"#?[_[:alpha:]][_[:alnum:]]"}
Add to settings.json:
"editor.tokenColorCustomizations": {
"[Default Dark+]": { // remove scope to apply to all themes
"textMateRules": [
{
"scope": "entity.name.type.interface.cs",
"settings": {
"foreground": "#b8d7a3"
}
},
{
"scope": "storage.type.interface.cs",
"settings": {
"foreground": "#b8d7a3"
}
}
]
}
},
VSCode 1.63.2:
Ctrl + Shift + P > Open Settings (JSON)
Paste this:
"editor.tokenColorCustomizations": {
"[Default Dark+]": {
"textMateRules": [
{
"scope": "entity.name.type.interface",
"settings": {
"foreground": "#a4ddaf"
}
}
]
}
},
I believe it can be partially done by editing "Program Files\Microsoft VS Code\resources\app\extensions\csharp\syntaxes" by adding support for "storage.type.interface.cs" with a regular expression that matches the convention.
Something like [I]([A-Z][a-z][A-Za-z]*)
You could also exclude possible mismatches like
IISManager, IPhoneDevice
https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide
https://www.apeth.com/nonblog/stories/textmatebundle.html
good luck with that and please let me know if you got it done