CRM operation Fax entity

Source: Internet
Author: User

Using system;
Using Microsoft. xrm. SDK;
Using Microsoft. CRM. SDK. messages;
Using Microsoft. xrm. SDK. query;

/// <Summary>
/// Fax
/// </Summary>
Public class faxhelper
{
Public static readonly string entityname = "fax ";
Public guid faxid = guid. empty;
Public iorganizationservice service;

/// <Summary>
/// Create a fax
/// </Summary>
Public void create ()
{
Whoamirequest userrequest = new whoamirequest ();
Whoamiresponse userresponse = (whoamiresponse) service. Execute (userrequest );
Guid _ userid = userresponse. userid;

Entity activityen = new entity () {logicalname = "activityparty "};
Activityen ["partyid"] = new entityreference () {logicalname = "systemuser", id = _ userid };

Entity en = new entity () {logicalname = entityname };
En ["subject"] = "pass value test ";
En ["from"] = new entity [] {activityen };
En ["to"] = new entity [] {activityen };
Faxid = service. Create (en );
}

/// <Summary>
/// Assign the fax to another user or team
/// </Summary>
/// <Param name = "assignee"> User or team reference </param>
Public void assign (entityreference assignee)
{
Assignrequest request = new assignrequest ();
Request. Target = new entityreference () {logicalname = entityname, id = faxid };
Request. assignee = assignee;
Assignresponse response = (assignresponse) service. Execute (request );
}

/// <Summary>
/// Send a fax
/// </Summary>
Public void sendfax ()
{
Sendfaxrequest request = new sendfaxrequest ();
Request. faxid = faxid;
Request. issuesend = true;
Sendfaxresponse response = (sendfaxresponse) service. Execute (request );
}

/// <Summary>
/// Delete all access permissions of the specified security subject (user or Team) to the fax
/// </Summary>
/// <Param name = "revokee"> User or team reference </param>
Public void revokeaccess (entityreference revokee)
{
Revokeaccessrequest request = new revokeaccessrequest ();
Request. Target = new entityreference () {logicalname = entityname, id = faxid };
Request. revokee = revokee;
Revokeaccessresponse response = (revokeaccessresponse) service. Execute (request );
}

/// <Summary>
/// Delete the fax
/// </Summary>
Public void Delete ()
{
Service. Delete (entityname, faxid );
}
}

CRM operation Fax entity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.