BizTeam.RetrieveParent Method

The RetrieveParent method retrieves the parent business unit of a team.

Syntax

[Visual Basic .NET]
Public Function RetrieveParent(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String
) As String
[C#]
public string RetrieveParent(
  CUserAuth  Caller,
  string  TeamId
);
[C++]
public: String* RetrieveParent(
  CUserAuth*  Caller,
  String*  TeamId
);

Parameters

Caller

Specifies the identity of the caller. To perform this action, the caller must have the prvReadTeam privilege and access rights on the object to be retrieved. See CUserAuth.

TeamId

Specifies the ID of the team.

Return Value

Returns a String type that specifies the XML data containing the parent business information. The XML schema is described by businessunit.xsd.

Remarks

The XML string returned from this method does not contain elements for fields where the value is null or contains empty strings. This improves performance by not sending more XML data than is necessary from the server to the client.

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

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

// strVirtualDirectory should be set with the name of the Microsoft CRM 
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "https://" + strServer + "/" + strVirtualDirectory + "/";

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

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
string strTeamID = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Retrieve the parent business unit for the team
   string strBusinessId = team.RetrieveParent(userAuth, strTeamID);

}
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 + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

© 2005 Microsoft Corporation. All rights reserved.