crm操作传真实体

using System;

using Microsoft.Xrm.Sdk;

using Microsoft.Crm.Sdk.Messages;

using Microsoft.Xrm.Sdk.Query;

/// <summary>

/// 传真

/// </summary>

public class FaxHelper

{

public static readonly string entityName = "fax";

public Guid faxId = Guid.Empty;

public IOrganizationService service;

/// <summary>

/// 创建传真

/// </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"] = "传值测试";

en["from"] = new Entity[]{ activityEn };

en["to"] = new Entity[] { activityEn };

faxId = service.Create(en);

}

/// <summary>

/// 将传真分派给其他用户或团队

/// </summary>

/// <param name="assignee">用户或团队引用</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>

/// 发送传真

/// </summary>

public void SendFax()

{

SendFaxRequest request = new SendFaxRequest();

request.FaxId = faxId;

request.IssueSend = true;

SendFaxResponse response = (SendFaxResponse)service.Execute(request);

}

/// <summary>

/// 删除指定的安全主体(用户或团队)对传真的所有访问权限

/// </summary>

/// <param name="revokee">用户或团队引用</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>

/// 删除传真

/// </summary>

public void Delete()

{

service.Delete(entityName, faxId);

}

}

时间: 2024-10-17 15:17:39

crm操作传真实体的相关文章

crm操作报价单实体

using System; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk.Query; /// <summary> /// 报价单 /// </summary> public class QuoteHelper { public static readonly string entityName = "quote"; public Guid q

crm操作商机实体

using System; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; public class OpportunityHelper { public static readonly string entityName = "opportunity"; public Guid opportunityId = Guid.Empty; /// <summary> /// 创建商机 /// </sum

crm操作约会实体

using System; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk.Query; /// <summary> /// 约会 /// </summary> public class AppointmentHelper { public static readonly string entityName = "appointment"; pu

crm操作案例实体

using System; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk.Query; /// <summary> /// 案例 /// </summary> public class IncidentHelper { public static readonly string entityName = "incident"; public G

crm操作发票实体

using System; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; using Microsoft.Crm.Sdk.Messages; /// <summary> /// 发票 /// </summary> public class InvoiceHelper { public static readonly string entityName = "invoice"; public Gui

crm操作销售合同实体

using System; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk.Query; /// <summary> /// 销售合同 /// </summary> public class ContractHelper { public static readonly string entityName = "contract"; public

crm操作货币实体

using System; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; /// <summary> /// 货币 /// </summary> public class TransactionCurrencyHelper { public static readonly string entityName = "transactioncurrency"; public Guid trans

crm操作产品实体

using System; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; /// <summary> /// 产品 /// </summary> public class ProductHelper { public static readonly string entityName = "product"; public Guid productId = Guid.Empty; publi

crm操作权限

using System; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; using System.Collections.Generic; using Microsoft.Crm.Sdk.Messages; /// <summary> /// 权限 /// </summary> public class PrivilegeHelper { public static readonly string entityNa