web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Query a User's Schedule for Open Time Slots Using VB.NET in Microsoft Dynamics CRM 2011

Jamie Miley Profile Picture Jamie Miley 2,060
This illustration shows how to query a user's schedule for open time blocks using VB.NET  in Microsoft Dynamics CRM 2011 with QueryScheduleRequest.
    Ok, here is what the code looks like!
    In VB.NET

    Dim reqWAI As New WhoAmIRequest()
    Dim respWAI As WhoAmIResponse = DirectCast(_serviceProxy.Execute(reqWAI), WhoAmIResponse)
    
    Dim reqSchedule As New QueryScheduleRequest()
    reqSchedule.ResourceId = respWAI.UserId
    reqSchedule.Start = DateTime.Now
    reqSchedule.End = DateTime.Today.AddDays(3)
    Dim tmc As New TimeCode()
    tmc = TimeCode.Available
    reqSchedule.TimeCodes = New TimeCode() {TimeCode.Available}
    
    Dim respSchedule As QueryScheduleResponse = DirectCast(slos.Execute(reqSchedule), QueryScheduleResponse)
    
    If respSchedule.TimeInfos.Length > 0 Then
        'act on timeslots
    Else
        'user has no free time that meets these parameters
    End If
    
    

    If you need help instantiating a service object in .NET within a plugin check out this post:
    http://mileyja.blogspot.com/2011/04/instantiating-service-object-within.html

    I hope this helps!
    -



    This was originally posted here.

    Comments

    *This post is locked for comments