Share via


BizOrganization.UpdateSettings Method

The UpdateSettings method updates the settings for an organization.

Syntax

[Visual Basic .NET]
Public Sub UpdateSettings(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal OrganizationXml As String
)
[C#]
public void UpdateSettings(
  CUserAuth  Caller,
  string  OrganizationId,
  string  OrganizationXml
);
[C++]
public: void UpdateSettings(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  OrganizationXml
);

Parameters

Caller

Specifies the identity of the caller. The caller must have the prvWriteOrganization privilege to perform this action. See CUserAuth.

OrganizationId

Specifies the ID of the organization. This ID is obtained when you create the Organizational Unit in Active Directory.

OrganizationXml

Specifies an XML string containing the organization information. The XML schema is described by organization.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

Note The following example contains sample data for the administrator login name and password. This is for illustration only. User credentials should never be hard-coded. For more information, see Building Secure ASP.NET Applications, https://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp.

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "https://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.CRM.Proxy.BizUser bizUser = new Microsoft.CRM.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizOrganization proxy object
Microsoft.CRM.Proxy.BizOrganization organization = new Microsoft.CRM.Proxy.BizOrganization ();
organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
organization.Url = strDir + "BizOrganization.srf";

string strOrgUpdateXML = "";
string strOrgName = "Wingtip Toys";

// Get the GUID of an OU from Active Directory
// that is going to represent the OU for the Microsoft CRM organization object
// The name of the OU should be the same as the name of the Microsoft CRM organization
// The organization is created in Microsoft CRM
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

// See Note above regarding the use of hard-coded passwords
string strDomainAdminUserName = "Administrator";
string strDomainAdminUserPass = "Admin";
string strDomainName = "MyDomain";

string strErrorMsg = "";


try
{
   Microsoft.CRM.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set the XML string for the update
   strOrgUpdateXML = "<organization>" + 
                     "<caseprefix>CasePrefix</caseprefix>" + 
                     "<contractprefix>ContractPrefix</contractprefix>" + 
                     "<currentcasenumber>CurrentCaseNumber</currentcasenumber>" +
                     "<currentcontractnumber>CurrentContractNumber</currentcontractnumber>" + 
                     "<fiscalperiodtype>FiscalPeriodType</fiscalperiodtype>" +
                  "</organization>";
   
   // Update settings for the organization
   organization.UpdateSettings(userAuth, strOrgId, strOrgUpdateXML);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}      

Requirements

Namespace: Microsoft.CRM.Proxy

Assembly: microsoft.crm.proxy.dll

See Also

© 2003 Microsoft Corporation. All rights reserved.