Hi, All
I have a requirement to get
How many Business Unit are there for that BU
How many users and teams are there .
What will be the advanced find search after downloaded how to add it in console app
Answers will be verified
Thanks
Hi, All
I have a requirement to get
How many Business Unit are there for that BU
How many users and teams are there .
What will be the advanced find search after downloaded how to add it in console app
Answers will be verified
Thanks
Showing object reference null error
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xrm.Tooling.Connector;
using Microsoft.Xrm.Sdk;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Query;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
try
{
var connectionString = @"AuthType = Office365; Url = xyz/;Username=abc.onmicrosoft.com ;Password=xxx";
CrmServiceClient conn = new CrmServiceClient(connectionString);
IOrganizationService service;
service = (IOrganizationService)conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;
string fetchXmlCurrentUserbusinessunit = @" < fetch version = '1.0'
output - format = 'xml-platform'
mapping = 'logical'
distinct = 'false' > < entity name = 'businessunit' > < attribute name = 'businessunitid' / > < filter type = 'and' > < condition attribute = 'isDisabled'
operator = 'eq' / > < / filter > < / entity > < / fetch > ";
var businessunit = service.RetrieveMultiple(new FetchExpression(fetchXmlCurrentUserbusinessunit));
ColumnSet allFields = new ColumnSet() { AllColumns = true };
//Entity retrievedContact = service.Retrieve(contact.LogicalName, contactId, new ColumnSet(true));
//Console.WriteLine("Record retrieved {0}", retrievedContact.Id.ToString());
// Guid businessunitId = service.Retrieve(businessunit);
// Console.WriteLine("businessunit", businessunit.ToString());
// Entity businessunit = service.Retrieve("businessunit", businessunit, allFields);
// retrievedBusinessunit = service.Retrieve(Businessunit.LogicalName, businessunitId, attributes);
foreach (var c in businessunit.Entities)
{
Console.WriteLine("retreived");
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
}
}
Any other solution or steps pls .how to add syntax
Any links or steps available
Hello,
I guess you'll need 3 requests : One is global and two are embeded under teh first One,
Request 1: the first will retrieve all BusinessUnits (BusinessUnitId , Name).
(Loop Over the list of BusinessUnits):
Request 2-1: For each Bu you'll look for its associated Teams Via the (BusinessUnitId) attribute on the team entity.
Request 2-2 : For each Bu you'll look for its associated SystemUsers Via the (BusinessUnitId) attribute on the System User entity.
and keep the counter turning :)
This will do it my friend.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156