locked
Get customers list using SDK for Microsoft Partner Center (CSP) RRS feed

  • Question

  • Hello,

    I have downloaded SDK for CSP.

    Now i am trying to retrieve all customer's list, but i am getting error as "Unauthorized".

    I am using below method to retrieve customer's list.

    //all the operations executed on this partner operation instance will share the same correlation Id but will differ in request Id
                IPartnerOperations scopedPartnerOperations = partnerOperations.With(RequestContextFactory.Create(Guid.NewGuid()));
    
                // read customers into chunks of 40s
                var customersBatch = scopedPartnerOperations.Customers.Query(QueryFactory.BuildIndexedQuery(40));
                var customersEnumerator = scopedPartnerOperations.Enumerators.Customers.Create(customersBatch);
    
                while (customersEnumerator.HasValue)
                {
                    Console.Out.WriteLine("Customer count: " + customersEnumerator.Current.TotalCount);
    
                    foreach (var customer in customersEnumerator.Current.Items)
                    {
                        Console.Out.WriteLine("Customer Id: {0}", customer.Id);
                        Console.Out.WriteLine("Company Name: {0}", customer.CompanyProfile.CompanyName);
                        Console.Out.WriteLine();
                    }
    
                    allCustomers.AddRange(customersBatch.Items);
                    customersEnumerator.Next();
                }

    Can anyone help me on this?

    Friday, December 18, 2015 8:50 AM

Answers