Update linkedResource
Article
01/27/2024
6 contributors
Feedback
In this article
Namespace: microsoft.graph
Update the properties of a linkedResource object.
This API is available in the following national cloud deployments .
Global service
US Government L4
US Government L5 (DOD)
China operated by 21Vianet
✅
✅
✅
❌
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it . For details about delegated and application permissions, see Permission types . To learn more about these permissions, see the permissions reference .
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
Tasks.ReadWrite
Not available.
Delegated (personal Microsoft account)
Tasks.ReadWrite
Not available.
Application
Not supported.
Not supported.
HTTP request
PATCH /me/todo/lists/{todoTaskListId}/tasks/{taskId}/linkedResources/{linkedResourcesId}
PATCH /users/{id|userPrincipalName}/todo/lists/{todoTaskListId}/tasks/{taskId}/linkedResources/{linkedResourcesId}
Request body
In the request body, supply a JSON representation of the linkedResource object.
The following table shows the properties that are required when you update the linkedResource .
Property
Type
Description
id
String
Server generated Id for the linked entity Inherited from entity
Response
If successful, this method returns a 200 OK
response code and an updated linkedResource object in the response body.
Examples
Request
PATCH https://graph.microsoft.com/v1.0/me/todo/lists/dfsdc-f9dfdfs-dcsda9/tasks/e2dc-f9cce2-dce29/linkedResources/f9cddce2-dce2-f9cd-e2dc-cdf9e2dccdf9
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.linkedResource",
"webUrl": "http://microsoft.com",
"applicationName": "Microsoft",
"displayName": "Microsoft"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new LinkedResource
{
OdataType = "#microsoft.graph.linkedResource",
WebUrl = "http://microsoft.com",
ApplicationName = "Microsoft",
DisplayName = "Microsoft",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Todo.Lists["{todoTaskList-id}"].Tasks["{todoTask-id}"].LinkedResources["{linkedResource-id}"].PatchAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc users todo lists tasks linked-resources patch --user-id {user-id} --todo-task-list-id {todoTaskList-id} --todo-task-id {todoTask-id} --linked-resource-id {linkedResource-id} --body '{\
"@odata.type": "#microsoft.graph.linkedResource",\
"webUrl": "http://microsoft.com",\
"applicationName": "Microsoft",\
"displayName": "Microsoft"\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewLinkedResource()
webUrl := "http://microsoft.com"
requestBody.SetWebUrl(&webUrl)
applicationName := "Microsoft"
requestBody.SetApplicationName(&applicationName)
displayName := "Microsoft"
requestBody.SetDisplayName(&displayName)
linkedResources, err := graphClient.Me().Todo().Lists().ByTodoTaskListId("todoTaskList-id").Tasks().ByTodoTaskId("todoTask-id").LinkedResources().ByLinkedResourceId("linkedResource-id").Patch(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
LinkedResource linkedResource = new LinkedResource();
linkedResource.setOdataType("#microsoft.graph.linkedResource");
linkedResource.setWebUrl("http://microsoft.com");
linkedResource.setApplicationName("Microsoft");
linkedResource.setDisplayName("Microsoft");
LinkedResource result = graphClient.me().todo().lists().byTodoTaskListId("{todoTaskList-id}").tasks().byTodoTaskId("{todoTask-id}").linkedResources().byLinkedResourceId("{linkedResource-id}").patch(linkedResource);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const linkedResource = {
'@odata.type': '#microsoft.graph.linkedResource',
webUrl: 'http://microsoft.com',
applicationName: 'Microsoft',
displayName: 'Microsoft'
};
await client.api('/me/todo/lists/dfsdc-f9dfdfs-dcsda9/tasks/e2dc-f9cce2-dce29/linkedResources/f9cddce2-dce2-f9cd-e2dc-cdf9e2dccdf9')
.update(linkedResource);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\LinkedResource;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new LinkedResource();
$requestBody->setOdataType('#microsoft.graph.linkedResource');
$requestBody->setWebUrl('http://microsoft.com');
$requestBody->setApplicationName('Microsoft');
$requestBody->setDisplayName('Microsoft');
$result = $graphServiceClient->me()->todo()->lists()->byTodoTaskListId('todoTaskList-id')->tasks()->byTodoTaskId('todoTask-id')->linkedResources()->byLinkedResourceId('linkedResource-id')->patch($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.Users
$params = @{
"@odata.type" = "#microsoft.graph.linkedResource"
webUrl = "http://microsoft.com"
applicationName = "Microsoft"
displayName = "Microsoft"
}
# A UPN can also be used as -UserId.
Update-MgUserTodoListTaskLinkedResource -UserId $userId -TodoTaskListId $todoTaskListId -TodoTaskId $todoTaskId -LinkedResourceId $linkedResourceId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
from msgraph import GraphServiceClient
from msgraph.generated.models.linked_resource import LinkedResource
graph_client = GraphServiceClient(credentials, scopes)
request_body = LinkedResource(
odata_type = "#microsoft.graph.linkedResource",
web_url = "http://microsoft.com",
application_name = "Microsoft",
display_name = "Microsoft",
)
result = await graph_client.me.todo.lists.by_todo_task_list_id('todoTaskList-id').tasks.by_todo_task_id('todoTask-id').linked_resources.by_linked_resource_id('linkedResource-id').patch(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.linkedResource",
"id": "f9cddce2-dce2-f9cd-e2dc-cdf9e2dccdf9",
"webUrl": "http://microsoft.com",
"applicationName": "Microsoft",
"displayName": "Microsoft",
"externalId": "dk9cddce2-dce2-f9dd-e2dc-cdf9e2dccdf9"
}