2017-04-10 4 views
0

ユーザーIDが与えられたので、私はCventからユーザーが登録されているすべてのイベントを取得する方法を探しています。登録済みの連絡先IDですべてのCventイベントを取得するにはどうすればよいですか?

これは、すべて Cventイベントを取得し、ユーザーが登録されていないものを除外するよりも理想的です。

これは私が試してみました「検索」のアプローチです:

  CvSearch userEventSearch = new CvSearch(); 
      userEventSearch.Filter = new Filter[1]; 
      userEventSearch.Filter[0] = new Filter(); 
      userEventSearch.Filter[0].Operator = CvSearchOperatorType.Includes; 

      userEventSearch.Filter[0].Field = <What field to use here?>; 
      userEventSearch.Filter[0].Value = <userid>; 

      ids = _cventClient.Search(ref _sessionHeader, CvObjectType.Event, userEventSearch).ToList(); 

私は私が選ぶことができるフィールドのリストで探していますが、私はそれらのいずれかがに関連信じていません私が欲しい情報: http://tek-works.com/cvent-api-event-fields-and-their-format/

はまた、役に立つかもしれない「検索」のアプローチがあるが、私は、これは私にとって非常に有用であろうと信じていない:

CvObject[] objects = _cventClient.Retrieve(ref _sessionHeader, CvObjectType.<What CvObjectType to use here?>, new[] { <userid> }); 

私は、必要な情報を得るための回避策があるかどうかを判断しようとしています。 (たとえば、登録を取得して、必要なイベントを取得するために登録を行う必要がありますか?)

ありがとうございます!

答えて

0

私はそれを理解しました。多分これは将来他人を助けるでしょう。まず、ユーザーのすべての登録を検索して取得する必要があります。

  // First search for all registrations for this user using their contact id (SourceId). 
      CvSearch userRegistrationSearch = new CvSearch(); 
      userRegistrationSearch.Filter = new Filter[1]; 
      userRegistrationSearch.Filter[0] = new Filter(); 
      userRegistrationSearch.Filter[0].Operator = CvSearchOperatorType.Includes; 

      userRegistrationSearch.Filter[0].Field = "SourceId"; 
      userRegistrationSearch.Filter[0].Value = registeredContactId; 

      var registrationIds = _cventClient.Search(ref _sessionHeader, CvObjectType.Registration, userRegistrationSearch); 

      // Using the results of that search, retrive all the registrations from Cvent 
      var registrations = _cventClient.Retrieve(ref _sessionHeader, CvObjectType.Registration, registrationIds).ToList().ConvertAll(items => (Registration)items); 

      // Return all the event ids from these registrations. 
      return registrations.Select(r => r.EventId).ToList(); 
:あなたはそれをやった後は

、あなたはEVENTIDSを取得するために、これらの登録を使用することができます

関連する問題