Κοινή χρήση μέσω


GenerateSharedLinkRequest Class

Definition

Creates a link to a table row that can be shared with other system users.

[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class GenerateSharedLinkRequest : Microsoft.Xrm.Sdk.OrganizationRequest
[<System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")>]
type GenerateSharedLinkRequest = class
    inherit OrganizationRequest
Public NotInheritable Class GenerateSharedLinkRequest
Inherits OrganizationRequest
Inheritance
GenerateSharedLinkRequest
Attributes

Examples

/// <summary>
/// Creates a shared link for a table row.
/// </summary>
/// <param name="client">A ServiceClient instance.</param>
/// <param name="entRef">The target table row.</param>
/// <param name="rights">Access rights for the table row.</param>
/// <returns>Unique identifier of the shared link.</returns>
public Guid Create_SharedLink(ServiceClient client, EntityReference entRef,
      AccessRights rights)
  {
      GenerateSharedLinkRequest request = new()
      {
          Target = entRef,
          SharedRights = rights   
      };

      GenerateSharedLinkResponse response = 
          (GenerateSharedLinkResponse)client.Execute(request);

      EntityReference linkRef = new("shareLink", (Guid)response.Results["shareLink"]);
      return linkRef.Id;
  }
/// <summary>
/// Enables user access to an account table row using a shared link.
/// </summary>
/// <param name="client">A ServiceClient instance.</param>
/// <param name="entityId">The target table row.</param>
public void Enable_SharedLink(ServiceClient client, EntityReference entRef)
  {
      Entity row = new("sharedlinksetting");
      row.Attributes = new AttributeCollection()
      {
          // The "Entity" table contains a row of data that defines every other table.
          // Here we use the standard ID of the account table that was obtained from
          // the Entity table using Power Apps under Tables > Entity > Entity columns
          // and data.

          {"extensionofrecordid", new EntityReference("account", new Guid("70816501-edb9-4740-a16c-6a5efbc05d84")) },
          {"isenabledforsharedlinkcreation", true },
          {"name", "Account Sharedlink setting" }
      };

      Guid settingId = client.Create(row);
  }

Remarks

A table must first be enabled for shared links prior to creating a shared link. See the sharedlinksetting table.

Constructors

GenerateSharedLinkRequest()

Initializes a new instance of the GenerateSharedLinkRequest class.

Properties

ExtensionData

Gets or sets the structure that contains extra data. Optional.

(Inherited from OrganizationRequest)
Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
RequestId

Gets or sets the ID of the request. Optional.

(Inherited from OrganizationRequest)
RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
SharedRights

Gets or sets the access rights for the table row.

Target

Gets or sets the target table row.

Applies to

See also