QueryMultipleSchedules Message (CrmService)
![]() |
[Applies to: Microsoft Dynamics CRM 4.0]
Find the latest SDK documentation: CRM 2015 SDK
| Works for all deployment types | Works online and offline |
Searches multiple resources for an available time slot matching the specified parameters. This is similar to the QuerySchedule message but it works for multiple resources at one time.
The relevant classes are specified in the following table.
| Type | Class |
| Request | QueryMultipleSchedulesRequest |
| Response | QueryMultipleSchedulesResponse |
| Entity | resource |
Remarks
To use this message, pass an instance of the QueryMultipleSchedulesRequest class as the request parameter in the Execute method.
To perform this action, the caller must have access rights on the entity instances specified in the request class. For a list of required privileges, see QueryMultipleSchedules Privileges.
Example
The following code example shows how to use the QueryMultipleSchedules message.
[C#]
// Set up the CRM service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0;
token.OrganizationName = "AdventureWorksCycle";
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
// The user whose schedule is being retrieved.
Guid resource = user.UserId;
// Create the request object.
QueryMultipleSchedulesRequest schedule = new QueryMultipleSchedulesRequest();
schedule.ResourceIds = new Guid[] {resource};
schedule.Start = new CrmDateTime();
schedule.Start.Value = "2005-01-01T00:00:00";
schedule.End = new CrmDateTime();
schedule.End.Value = "2005-01-08T00:00:00";
schedule.TimeCodes = new TimeCode[]{TimeCode.Available};
// Execute the request.
QueryMultipleSchedulesResponse scheduled = (QueryMultipleSchedulesResponse)service.Execute(schedule);
[Visual Basic .NET]
' Set up the CRM service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle";
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials
' The user whose schedule is being retrieved.
Dim resource As Guid = user.UserId
' Create the request object.
Dim schedule As New QueryMultipleSchedulesRequest()
schedule.ResourceIds = New Guid() {resource}
schedule.Start = New CrmDateTime()
schedule.Start.Value = "2005-01-01T00:00:00"
schedule.End = New CrmDateTime()
schedule.End.Value = "2005-01-08T00:00:00"
schedule.TimeCodes = New TimeCode() {TimeCode.Available}
' Execute the request.
Dim scheduled As QueryMultipleSchedulesResponse = CType(service.Execute(schedule), QueryMultipleSchedulesResponse)
See Also
Concepts
Reference
.gif)