Я пытаюсь написать fetch xml для получения BusinessUnitID и Equipment ID из объекта Facility / Equipment, я написал этот fetch xml в коде C #, но он выдает исключение нулевой ссылки / System.NullReferenceException в строке (выделенная жирным шрифтом строка) У меня нет нулевых значений в объекте объекта / оборудования. Вот мой код:
private static OrganizationService _orgService;
string fetchBU = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='equipment'>
<attribute name='name' />
<attribute name='equipmentid' />
<order attribute='name' descending='false' />
<filter type='and'>
<condition attribute='businessunitid' operator='eq-businessid' />
</filter>
</entity>
</fetch>";
EntityCollection ec = _orgService.RetrieveMultiple(new FetchExpression(fetchBU));
if (ec.Entities.Count > 0)
{
Guid BusinessUnitId = (Guid)ec[0].Attributes["businessunitid"];
}
Может кто-нибудь посоветовать мне это? Заранее спасибо!