BizTeam.CreateAndRetrieve Method
The CreateAndRetrieve method creates a new team and then retrieves it.
Syntax
[Visual Basic .NET]
Public Function CreateAndRetrieve(
ByVal Caller As CUserAuth,
ByVal TeamXML As String,
ByVal Members As String()
) As String
[C#]
public string CreateAndRetrieve(
CUserAuth Caller,
string TeamXML,
string[] Members
);
[C++]
public: String* CreateAndRetrieve(
CUserAuth* Caller,
String* TeamXML,
String* Members __gc[]
);
Parameters
Caller
Specifies the identity of the caller. The caller must have the prvCreateTeam and prvReadTeam privileges to perform this action. See CUserAuth.
TeamXML
Specifies an XML string containing the team information. The XML schema is described by team.xsd.
Members
Specifies an array of user IDs for the initial set of members for the team.
Return Value
Returns a String type that specifies the XML data containing the newly created team information. The XML schema is described by team.xsd.
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
[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.Proxy.BizUser user = new Microsoft.CRM.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";
// BizTeam proxy object
Microsoft.CRM.Proxy.BizTeam team = new Microsoft.CRM.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";
// Declare the caller
Microsoft.CRM.Proxy.CUserAuth userAuth = null;
string strErrorMsg;
try
{
// Get the UserAuth of the current logged-on user
userAuth = user.WhoAmI();
// Build a team XML string in the business unit of the caller
string strTeamXML = "<team>";
strTeamXML += "<name>Another Team</name>";
strTeamXML += "<businessunitid>" + userAuth.MerchantId + "</businessunitid>";
strTeamXML += "<emailaddress>anotherteam@northwindtraders.com</emailaddress></team>";
string[] members = new string[1];
members[0] = userAuth.UserId;
// Create and then retrieve the new team
string strNewTeamXml = team.CreateAndRetrieve(userAuth, strTeamXML, members);
}
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.Proxy
Assembly: microsoft.crm.proxy.dll
See Also