【问题标题】:SearchRequest and SearchReponse Classes are not present for silverlight application in CRM 2011?CRM 2011 中的 Silverlight 应用程序不存在 SearchRequest 和 SearchReponse 类?
【发布时间】:2013-09-21 16:29:18
【问题描述】:

我想在 CRM 2011 中搜索给定资源的所有可用时间段。现在 CRM 2011 sdk 在控制台应用程序中提供了一个示例,它工作正常,但我想在 Silverlight 应用程序中做同样的事情。在我的 silverlight 应用程序中,我找不到 SearchRequest 和 SearchReponse 类。

谁能帮我在silverlight应用程序中如何做到这一点?

【问题讨论】:

    标签: dynamics-crm-2011 dynamics-crm dynamics-crm-4


    【解决方案1】:

    首先准备 AppointmentRequest 对象

         private void checkButton_Click(object sender, RoutedEventArgs e)
            {           
                AppointmentRequest appReq = new AppointmentRequest
                {
                    Objectives = new ObservableCollection<ObjectiveRelation>(),
                    RequiredResources = new ObservableCollection<RequiredResource>(),
                    AppointmentsToIgnore = new ObservableCollection<AppointmentsToIgnore>(),
                    Constraints = new ObservableCollection<ConstraintRelation>(),
                    Sites = new ObservableCollection<Guid>(),
            Duration = 60,
            Direction = SearchDirection.Forward,
            NumberOfResults = 5,
            ServiceId = new Guid("DD535FD0-F84B-E111-8F2F-00505688095F"),
            SearchWindowStart = DateTime.UtcNow,
            SearchWindowEnd = DateTime.UtcNow.AddDays(7.0),
            AnchorOffset = 300
        };
    
        OrganizationRequest req = new OrganizationRequest() { RequestName = "Search" };
    
        req["AppointmentRequest"] = appReq;
    
        IOrganizationService service = SilverlightUtility.GetSoapService();
    
        service.BeginExecute(req, new AsyncCallback(GetAppReqResult), service);
    }
    
    Following is the Asynchromus callback function
    
    private void GetAppReqResult(IAsyncResult res)
    {
       try
       {
         OrganizationResponse resp = 
                              ((IOrganizationService)res.AsyncState).EndExecute(res);
    
         SearchResults results = (SearchResults)resp["SearchResults"];
    
         this.Dispatcher.BeginInvoke(() => ProcessAppointments(results));        
    
       }
       catch (Exception)
       {
           MessageBox.Show("Error Occurred");
       }
    }
    

    results 对象将包含传递的约会请求对象的所有可能时间段。 希望对像我这样的人有所帮助

    【讨论】:

      猜你喜欢
      • 2013-02-18
      • 1970-01-01
      • 1970-01-01
      • 2013-03-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-02
      • 1970-01-01
      相关资源
      最近更新 更多