internal Contact GetContactByOptions(Guid contactId, ExpandOptions options = null)
     {
         using (XConnectClient client = SitecoreXConnectClientConfiguration.GetClient("xconnect/clientconfig"))
         {
             if (options == null)
             {
                 options = (ExpandOptions) new ContactExpandOptions(Array.Empty <string>())
                 {
                     Interactions = new RelatedInteractionsExpandOptions(new string[1]
                     {
                         "IpInfo"
                     })
                 }
             }
             ;
             ContactReference contactReference = new ContactReference(contactId);
             Contact          contact          = XConnectSynchronousExtensions.Get <Contact>((IXdbContext)client, (IEntityReference <Contact>)contactReference, options);
             if (contact == null)
             {
                 throw new ContactNotFoundException(string.Format("No Contact with id [{0}] found", (object)contactId));
             }
             return(contact);
         }
     }
 }
Exemple #2
0
        public string ExpandRouteSpec(string spec, ExpandOptions expandOptions)
        {
            int expandedRouteSpecSize = 0;

            TestForError(
                niSE_ExpandRouteSpec(
                    _sessionHandle,
                    spec,
                    expandOptions,
                    null,
                    out expandedRouteSpecSize));
            var expandedRouteSpec = new StringBuilder();

            if (expandedRouteSpecSize > 0)
            {
                expandedRouteSpec.Capacity = expandedRouteSpecSize;
                TestForError(
                    niSE_ExpandRouteSpec(
                        _sessionHandle,
                        spec,
                        expandOptions,
                        expandedRouteSpec,
                        out expandedRouteSpecSize));
            }

            return(expandedRouteSpec.ToString());
        }
Exemple #3
0
 private static extern int niSE_ExpandRouteSpec(NISwitchExecutiveHandle vi, string spec, ExpandOptions expandOptions, StringBuilder expandedRouteSpec, out int expandedRouteSpecSize);
Exemple #4
0
 public string ExpandRouteSpec(string spec, ExpandOptions expandOptions)
 {
     return(string.Empty);
 }
Exemple #5
0
 public GetOptions(ExpandOptions expand, List <string> childReferences = null, ExpandOptions? @default = null)
 {
     Initial = @default ?? ExpandOptions.All;
     Expand  = expand;
     this.resourceReferences = childReferences ?? new List <string>();
 }
Exemple #6
0
 public static async Task <Contact> ResolveContact(XConnectClient client, Guid contactId, ExpandOptions expandOptions)
 {
     return(await client.GetContactAsync(contactId, expandOptions));
 }
        public static Contact GetContactFromTrackerId(this XConnectClient client, Guid contactId, ExpandOptions contactExpandOptions)
        {
            var id = new IdentifiedContactReference("xDB.Tracker", contactId.ToString("N"));

            return(client.GetContactAsync(id, contactExpandOptions).ConfigureAwait(false).GetAwaiter().GetResult());
        }