I have a flow that needs to get an existing Sharing Link from a file and send an email with this link to the users than can access it. From the SharePoint file, I created a HTTP Request to SharePoint, which returns a JSON that contais the link in the 'url' field. This 'url' field appears 3 times in the JSON: the first one with the link I want, and the other ones as 'null'.
I want to extract from this JSON a string that contains only the link I need, so I can use it in the body of the e-mail. Here is the JSON:
The link I need is:
"Url": "https://xxxxxxxxxxxxx.sharepoint.com/:b:/s/xxxxxxxx/Ee_PZRPWr8VHuwt8070ib-ABkiiYU7KuYGgnnTF93Xix6Q"
{
"odata.metadata": "https://xxxxxx.sharepoint.com/sites/xxxxx/_api/$metadata#SP.ApiData.SharingInformations/@Element&$select=permissionsInformation",
"odata.type": "SP.Sharing.SharingInformation",
"odata.id": "https://xxxxxx.sharepoint.com/sites/xxxxx/_api/web/lists/getbytitle('Documentos')/items(690891)/GetSharingInformation",
"odata.editLink": "web/lists/getbytitle('Documentos')/items(690891)/GetSharingInformation",
"permissionsInformation": {
"hasInheritedLinks": false,
"links": [
{
"isInherited": false,
"linkDetails": {
"AllowsAnonymousAccess": false,
"ApplicationId": null,
"BlocksDownload": false,
"Created": "2022-10-19T18:51:21.176Z",
"CreatedBy": {
"directoryObjectId": null,
"email": "xxxxx@xxxxx.com.br",
"expiration": "",
"id": 131,
"isActive": true,
"isExternal": false,
"jobTitle": "xxxxxxxxxxxx",
"loginName": "i:0#.f|membership|xxxxx@xxxxx.com.br",
"name": "xxxxxxxxxxxxxx",
"principalType": 0,
"userId": null,
"userPrincipalName": "xxxxx@xxxxx.com.br"
},
"Description": null,
"Embeddable": false,
"Expiration": "",
"HasExternalGuestInvitees": true,
"Invitations": [
{
"invitedBy": {
"directoryObjectId": null,
"email": "xxxxx@xxxxx.com.br",
"expiration": "",
"id": 131,
"isActive": true,
"isExternal": false,
"jobTitle": "xxxxxxxxxxxx",
"loginName": "i:0#.f|membership|xxxxx@xxxxx.com.br",
"name": "xxxxxxxxxxxxxx",
"principalType": 1,
"userId": null,
"userPrincipalName": "xxxxx@xxxxx.com.br"
},
"invitedOn": "2022-10-19T18:51:21.114Z",
"invitee": {
"directoryObjectId": null,
"email": "xxxxx@xxxxx.com.br",
"expiration": "",
"id": -1,
"isActive": false,
"isExternal": true,
"jobTitle": null,
"loginName": null,
"name": "xxxxx@xxxxx.com.br",
"principalType": 0,
"userId": null,
"userPrincipalName": null
}
},
{
"invitedBy": {
"directoryObjectId": null,
"email": "xxxxx@xxxxx.com.br",
"expiration": "",
"id": 131,
"isActive": true,
"isExternal": false,
"jobTitle": "ANALISTA ESTRATEGIA INTELIGENCIA JUNIOR",
"loginName": "i:0#.f|membership|xxxxx@xxxxx.com.br",
"name": "xxxxxxxxxxxxxx",
"principalType": 1,
"userId": null,
"userPrincipalName": "xxxxx@xxxxx.com.br"
},
"invitedOn": "2022-10-19T18:51:21.114Z",
"invitee": {
"directoryObjectId": null,
"email": "xxxxx@xxxxx.com.br",
"expiration": null,
"id": -1,
"isActive": false,
"isExternal": true,
"jobTitle": null,
"loginName": null,
"name": "xxxxx@xxxxx.com.br",
"principalType": 0,
"userId": null,
"userPrincipalName": null
}
}
],
"IsActive": true,
"IsAddressBarLink": false,
"IsCreateOnlyLink": false,
"IsDefault": true,
"IsEditLink": false,
"IsFormsLink": false,
"IsManageListLink": false,
"IsReviewLink": false,
"IsUnhealthy": false,
"LastModified": "2022-10-19T18:51:21.176Z",
"LastModifiedBy": {
"directoryObjectId": null,
"email": "xxxxx@xxxxx.com.br",
"expiration": "",
"id": 131,
"isActive": true,
"isExternal": false,
"jobTitle": "xxxxxxxxxxxxxx",
"loginName": "i:0#.f|membership|xxxxx@xxxxx.com.br",
"name": "xxxxxxxxxxxxxxxxx",
"principalType": 0,
"userId": null,
"userPrincipalName": "xxxxx@xxxxx.com.br"
},
"LimitUseToApplication": false,
"LinkKind": 6,
"PasswordLastModified": "",
"PasswordLastModifiedBy": null,
"RedeemedUsers": [],
"RequiresPassword": false,
"RestrictedShareMembership": true,
"Scope": 2,
"ShareId": "cf77b78f-5735-4b56-b9f7-318721a0da09",
"ShareTokenString": "share=Ee_PZRPWr8VHuwt8070ib-ABkiiYU7KuYGgnnTF93Xix6Q",
"SharingLinkStatus": 0,
"TrackLinkUsers": false,
"Url": "https://xxxxxxxxxxxxx.sharepoint.com/:b:/s/xxxxxxxx/Ee_PZRPWr8VHuwt8070ib-ABkiiYU7KuYGgnnTF93Xix6Q"
},
"linkMembers": []
},
{
"isInherited": false,
"linkDetails": {
"AllowsAnonymousAccess": false,
"ApplicationId": null,
"BlocksDownload": false,
"Created": "",
"CreatedBy": null,
"Description": null,
"Embeddable": false,
"Expiration": "",
"HasExternalGuestInvitees": false,
"Invitations": [],
"IsActive": false,
"IsAddressBarLink": false,
"IsCreateOnlyLink": false,
"IsDefault": true,
"IsEditLink": false,
"IsFormsLink": false,
"IsManageListLink": false,
"IsReviewLink": false,
"IsUnhealthy": false,
"LastModified": "",
"LastModifiedBy": null,
"LimitUseToApplication": false,
"LinkKind": 3,
"PasswordLastModified": "",
"PasswordLastModifiedBy": null,
"RedeemedUsers": [],
"RequiresPassword": false,
"RestrictedShareMembership": false,
"Scope": -1,
"ShareId": "00000000-0000-0000-0000-000000000000",
"ShareTokenString": null,
"SharingLinkStatus": 0,
"TrackLinkUsers": false,
"Url": null
},
"linkMembers": []
},
{
"isInherited": false,
"linkDetails": {
"AllowsAnonymousAccess": false,
"ApplicationId": null,
"BlocksDownload": false,
"Created": "",
"CreatedBy": null,
"Description": null,
"Embeddable": false,
"Expiration": "",
"HasExternalGuestInvitees": false,
"Invitations": [],
"IsActive": false,
"IsAddressBarLink": false,
"IsCreateOnlyLink": false,
"IsDefault": true,
"IsEditLink": false,
"IsFormsLink": false,
"IsManageListLink": false,
"IsReviewLink": false,
"IsUnhealthy": false,
"LastModified": "",
"LastModifiedBy": null,
"LimitUseToApplication": false,
"LinkKind": 2,
"PasswordLastModified": "",
"PasswordLastModifiedBy": null,
"RedeemedUsers": [],
"RequiresPassword": false,
"RestrictedShareMembership": false,
"Scope": -1,
"ShareId": "00000000-0000-0000-0000-000000000000",
"ShareTokenString": null,
"SharingLinkStatus": 0,
"TrackLinkUsers": false,
"Url": null
},
"linkMembers": []
}
],
"principals": [
{
"principal": {
"directoryObjectId": null,
"email": "",
"expiration": null,
"id": 3,
"isActive": true,
"isExternal": false,
"jobTitle": null,
"loginName": "xxxxxxxxxxx",
"name": "xxxxxxxxxxxxxxx",
"principalType": 8,
"userId": null,
"userPrincipalName": null
},
"role": 3
},
{
"principal": {
"directoryObjectId": null,
"email": "",
"expiration": null,
"id": 4,
"isActive": true,
"isExternal": false,
"jobTitle": null,
"loginName": "xxxxxxxxxxxx",
"name": "xxxxxxxxxxxx",
"principalType": 8,
"userId": null,
"userPrincipalName": null
},
"role": 1
},
{
"principal": {
"directoryObjectId": null,
"email": "",
"expiration": null,
"id": 5,
"isActive": true,
"isExternal": false,
"jobTitle": null,
"loginName": "xxxxxxxxxxxxxxx",
"name": "xxxxxxxxxxxxxxxx",
"principalType": 8,
"userId": null,
"userPrincipalName": null
},
"role": 2
},
{
"principal": {
"directoryObjectId": null,
"email": "xxxxx@xxxxx.com.br",
"expiration": "",
"id": 207,
"isActive": true,
"isExternal": false,
"jobTitle": "xxxxxxxxxxxxxxx",
"loginName": "i:0#.f|membership|xxxxx@xxxxx.com.br",
"name": "xxxxxxxxxxxx",
"principalType": 1,
"userId": null,
"userPrincipalName": "xxxxx@xxxxx.com.br"
},
"role": 1
}
],
"siteAdmins": [
{
"principal": {
"directoryObjectId": null,
"email": "xxxxx@xxxxx.com.br",
"expiration": null,
"id": 6,
"isActive": true,
"isExternal": false,
"jobTitle": null,
"loginName": "c:0o.c|federateddirectoryclaimprovider|xxxxxxxxxxxxxxx-9a09-29cc582b02fb_o",
"name": "xxxxx@xxxxx.com.br",
"principalType": 4,
"userId": null,
"userPrincipalName": null
},
"role": 3
}
]
}
}