コード例 #1
0
        private AbstractItem CreateAppointment(string outlookId, string crmId, Outlook.OlMeetingStatus status)
        {
            AbstractItem result;

            Outlook.NameSpace session = Globals.ThisAddIn.GetOutlookSession();

            if (session != null)
            {
                Outlook.AppointmentItem legacy = null;
                Outlook.MAPIFolder      folder = session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);

                if (!string.IsNullOrEmpty(outlookId))
                {
                    legacy = folder.Items.Add(Outlook.OlItemType.olAppointmentItem);
                    legacy.MeetingStatus = status;
                    result            = new CallItem(legacy);
                    result.CrmEntryId = crmId;

                    this.ByCrmId[crmId] = result;
                    this.ByOutlookId[legacy.EntryID] = result;
                }
                else
                {
                    result = FindExistingAppointmentItem(outlookId, crmId, folder);
                }
            }
            else
            {
                throw new ShouldNotHappenException("No Outlook session!");
            }

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Create a new instance of ProtoAppointment, taking values from this Outlook item.
        /// </summary>
        /// <param name="olItem">The Outlook item to take values from.</param>
        public ProtoAppointment(Outlook.AppointmentItem olItem)
        {
            this.body     = olItem.Body;
            this.duration = olItem.Duration;
            this.end      = olItem.End;
            this.location = olItem.Location;
            this.start    = olItem.Start;
            this.subject  = olItem.Subject;
            this.globalId = olItem.GlobalAppointmentID;
            this.status   = olItem.MeetingStatus;

            var organiserProperty = olItem.UserProperties[AppointmentSyncing.OrganiserPropertyName];

            if (organiserProperty == null || string.IsNullOrWhiteSpace(organiserProperty.Value))
            {
                if (olItem.Organizer == clsGlobals.GetCurrentUsername())
                {
                    this.organiser = RestAPIWrapper.GetUserId();
                }
                else
                {
                    this.organiser = TryResolveOrganiser(olItem);
                }
            }
            else
            {
                this.organiser = organiserProperty.Value.ToString();
            }

            foreach (Outlook.Recipient recipient in olItem.Recipients)
            {
                this.recipientAddresses.Add(recipient.GetSmtpAddress());
            }
        }
コード例 #3
0
        public ProtoAppointment(Outlook.AppointmentItem olItem)
        {
            this.body      = olItem.Body;
            this.duration  = olItem.Duration;
            this.end       = olItem.End;
            this.location  = olItem.Location;
            this.start     = olItem.Start;
            this.subject   = olItem.Subject;
            this.outlookId = olItem.EntryID;
            this.status    = olItem.MeetingStatus;

            var organiserProperty = olItem.UserProperties[AppointmentSyncing.OrganiserPropertyName];

            if (organiserProperty == null || string.IsNullOrWhiteSpace(organiserProperty.Value))
            {
                this.organiser = RestAPIWrapper.GetUserId();
            }
            else
            {
                this.organiser = organiserProperty.Value.ToString();
            }
        }
コード例 #4
0
        /// <summary>
        /// Create a new instance of ProtoAppointment, taking values from this Outlook item.
        /// </summary>
        /// <param name="olItem">The Outlook item to take values from.</param>
        public ProtoAppointment(Outlook.AppointmentItem olItem)
        {
            this.olItem     = olItem;
            this.body       = olItem.Body;
            this.CrmEntryId = olItem.GetCrmId();
            this.duration   = olItem.Duration;
            this.end        = olItem.End;
            this.location   = olItem.Location;
            this.start      = olItem.Start;
            this.subject    = olItem.Subject;
            this.globalId   = olItem.GlobalAppointmentID;
            // this is resolved to the correct string in AsNameValues().
            this.status = olItem.MeetingStatus;

            var organiserProperty = olItem.UserProperties[AppointmentsSynchroniser <SyncStateType> .OrganiserPropertyName];

            if (organiserProperty == null || string.IsNullOrWhiteSpace(organiserProperty.Value))
            {
                if (olItem.Organizer == Globals.ThisAddIn.Application.GetCurrentUsername())
                {
                    this.organiser = CrmId.Get(RestAPIWrapper.GetUserId());
                }
                else
                {
                    this.organiser = TryResolveOrganiser(olItem);
                }
            }
            else
            {
                this.organiser = CrmId.Get(organiserProperty.Value.ToString());
            }

            foreach (Outlook.Recipient recipient in olItem.Recipients)
            {
                this.recipientAddresses.Add(recipient.GetSmtpAddress());
            }
        }
コード例 #5
0
 public ProtoItem(Outlook.OlMeetingStatus meetingStatus)
 {
     this.Status = meetingStatus;
 }