Share via


BizTeam.ReassignObjects Method

The ReassignObjects method reassigns all the objects owned by the team to another security principal (user or team). For more information, see the following Remarks.

Syntax

[Visual Basic .NET]
Public Sub ReassignObjects(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String,
  ByVal ReassignId As CSecurityPrincipal
)
[C#]
public void ReassignObjects(
  CUserAuth  Caller,
  string  TeamId,
  CSecurityPrincipal  ReassignId
);
[C++]
public: void ReassignObjects(
  CUserAuth*  Caller,
  String*  TeamId,
  CSecurityPrincipal*  ReassignId
);

Parameters

Caller

Specifies the identity of the caller. See CUserAuth.

TeamId

Specifies the ID of the team.

ReassignId

Specifies the security principal that will take ownership of all objects owned by the team. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note   The Microsoft CRM application does not support business-object assignments to teams. Therefore, any solutions built by using this method are not supported by the Microsoft CRM application.

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;
string strTeamID = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
string strAnotherTeamID = "{F9920C07-EE2A-4616-A7EC-1E9D280CF535}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Create a new security principal for a different team
   Microsoft.CRM.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.CRM.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strAnotherTeamID;
   securityPrincipal.Type = Microsoft.CRM.Proxy.SecurityPrincipalType.sptTeam;

   // Now reassign all the objects for that team
   team.ReassignObjects(userAuth, strTeamID, securityPrincipal);
   // Now all of the team objects are owned by strAnotherTeamID

}
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

© 2003 Microsoft Corporation. All rights reserved.