如何使用 C# 在 CRM 2013 中更改实体的状态和/或状态?
CRM 2011 的 SetStateRequest 和更早的 SetStateDynamicEntityRequest 都没有被识别。在线搜索似乎也没有帮助......我错过了命名空间还是什么?
提前致谢
命名空间:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Discovery;
using Microsoft.Xrm.Sdk.Messages;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Web.Services.Protocols;
功能:
private void changeUserStatus(Guid userId, IOrganizationService service, int state)
{
SetStateRequest setStateRequest = new SetStateRequest
{
EntityMoniker = new EntityReference("systemuser", userId),
State = new OptionSetValue(state),
Status = new OptionSetValue(-1),
};
service.Execute(setStateRequest);
}
重要提示: Visual Studio 2012 无法识别我的 SetStateRequest,因此与上面的示例不同,它没有突出显示,实际上是红色下划线,并在悬停时显示“未找到类型或命名空间”消息
编辑:我看到这个问题被否决了,如果我遗漏了什么,我很抱歉,但我真的没有更多信息可以提供,除了我昨天花了 4 个小时在网上寻找这个(包括 stackoverflow)没有任何利用。我可能使用了错误的搜索条件或在错误的地方寻找,但如果是这种情况,至少有人能指出我正确的方向吗?我是所有这一切(stackoverflow 和 crm2013)的初学者,我有点坚持这一点。再次感谢