Okay, I’m not the best Silverlight developer, I’ve only recently gotten started. And recently I was working on trying to find the appointments for a particular service. If you look at the SDK, there is a Sample: Schedule a Resource. It works great if you are creating a console application, but the same code doesn’t work if you are using Silverlight.
Here is the code from the sample that creates the AppointmentRequest:
AppointmentRequest appointmentReq = new AppointmentRequest
{
RequiredResources = new RequiredResource[] { vanReq },
Direction = SearchDirection.Backward,
Duration = 60,
NumberOfResults = 10,
ServiceId = _plumberServiceId,
// The search window describes the time when the resouce can be scheduled.
// It must be set.
SearchWindowStart = DateTime.Now.ToUniversalTime(),
SearchWindowEnd = DateTime.Now.AddDays(7).ToUniversalTime(),
UserTimeZoneCode = 1
};
Now, there are a lot of fields that they didn’t set, but since they are using the DLL files, they don’t need to. The reason this same request would fail using Silverlight is because the web-service expects the arrays to not be null. Using the DLL files, they end up as just empty arrays, but since we are using the ObservableCollection in Silverlight, we have to initialize the collections by creating empty fields. Then our request will be accepted.
AppointmentRequest appointmentReq = new AppointmentRequest
{
Objectives = new ObservableCollection(),
RequiredResources = new ObservableCollection(),
AppointmentsToIgnore = new ObservableCollection(),
Constraints = new ObservableCollection(),
Sites = new ObservableCollection(),
// Required Fields:
Duration=duration,
Direction=SearchDirection.Forward,
NumberOfResults = 20
};
You’ll still have to set the TimeZoneCode and adjust the dates accordingly just like they do in the SDK example. My personal preference here is to retrieve the usersettings and use the timezonecode from it.
Now, for all the people out there that use my SilverCRMSoap Library I have on codeplex, I did update the source code to include a BeginExecuteSearchRequest and modified the AppointmentRequest to have the default values specified.
With that, I think my bing maps scheduler will turn out great. Once it is done, I might update this post with a screenshot.
Happy Scheduling!
– mscrmblogger


Hi, Carlton, I want tot know if there is any way to filter dashboards?
Our requirement is to show different dashboard views for different business unit users.
Thanks for u time and patience.
thanks for the post.
it’s annoying that Microsoft is half pushing Silverlight but providing hardly any examples at all.
I think that the objectives line should be:
Objectives = new ObservableCollection()Thanks about the missing new. I will fix that in the article.
As far as Silverlight goes, I like Silverlight, and I like HTML5. Both are very rich and capable systems. Perhaps Scott Hanselman answered it best, "Even though browsers like Chrome release and update very often, not every company is going to upgrade all their browsers every week or even twice a year. Some enterprises will be on Firefox 3.6 for a while longer, or (hopefully not) IE6. Browser plugins like Silverlight and Flash can add new functionality faster. They are called plugins for a reason. They plug-in and add something."