DiscoverOrganizations() public static method

Discovers the organizations that the calling user belongs to.
public static DiscoverOrganizations ( IDiscoveryService service ) : OrganizationDetailCollection
service IDiscoveryService A Discovery service proxy instance.
return OrganizationDetailCollection
示例#1
0
        private bool ValidateWebServiceConnection()
        {
            try
            {
                ServerConnection.DiscoverOrganizations(this.DiscoveryClient);
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        public List <OrganizationDetail> GetAllOrganizations(Common.ValidationResult validationResult)
        {
            // Retrieve the list of all organizations
            List <OrganizationDetail> detail = new List <OrganizationDetail>();

            try
            {
                detail = ServerConnection.DiscoverOrganizations(this.DiscoveryClient).ToList();
            }
            catch (Exception ex)
            {
                if (validationResult != null)
                {
                    validationResult.AddError(string.Format(CultureInfo.CurrentUICulture, Resources.RetrieveAllCompaniesExceptionMessage, ex.Message));
                }
            }

            return(detail);
        }
示例#3
0
        // Retrieve a CRM object that can be used to get the various endpoints for calling the CRM web services
        private OrganizationDetail GetOrgExtDetail()
        {
            if (this.orgExtDetail == null)
            {
                // Retrieve the list of organizations that the logged on user belongs to.
                this.orgExtDetail = ServerConnection.FindOrganization(this.OrganizationName, ServerConnection.DiscoverOrganizations(this.DiscoveryClient).ToArray());

                // Check whether a matching organization was not found.
                if (this.orgExtDetail == null)
                {
                    throw new AdapterException(string.Format(CultureInfo.CurrentCulture, Resources.OrganizationNotFoundExceptionMessage, this.OrganizationName))
                          {
                              ExceptionId = ErrorCodes.OrganizationNotFound
                          };
                }
            }

            return(this.orgExtDetail);
        }