Exemplo n.º 1
0
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The Dfa user object running the code example.
    /// </param>
    public override void Run(DfaUser user) {
      // Create SiteRemoteService instance.
      SiteRemoteService service = (SiteRemoteService) user.GetService(
          DfaService.v1_19.SiteRemoteService);

      String searchString = _T("INSERT_SEARCH_STRING_CRITERIA_HERE");

      // Create DFA site search criteria structure.
      DfaSiteSearchCriteria searchCriteria = new DfaSiteSearchCriteria();
      searchCriteria.pageSize = 10;
      searchCriteria.searchString = searchString;

      try {
        // Get the sites.

        DfaSiteRecordSet dfaSiteRecordSet = service.getDfaSites(searchCriteria);

        // Display DFA site names and ids.
        if (dfaSiteRecordSet != null && dfaSiteRecordSet.records != null) {
          foreach (DfaSite dfaSite in dfaSiteRecordSet.records) {
            Console.WriteLine("DFA site with name \"{0}\" and id \"{1}\" was found.",
                dfaSite.name, dfaSite.id);
          }
        } else {
          Console.WriteLine("No DFA sites found for your search criteria.");
        }

      } catch (Exception ex) {
        Console.WriteLine("Failed to retrieve DFA sites. Exception says \"{0}\"",
            ex.Message);
      }
    }
Exemplo n.º 2
0
 public DfaSiteRecordSet getDfaSites(DfaSiteSearchCriteria sc) {
   object[] results = this.Invoke("getDfaSites", new object[] {sc});
   return ((DfaSiteRecordSet) (results[0]));
 }