예제 #1
0
파일: MessageActions.cs 프로젝트: mo5h/omeo
        protected override void ExecuteAction(IResource resource, PairIDs pairIDs)
        {
            Tracer._Trace("Execute action: UnDeleteIMAPMessageAction");
            Trace.WriteLine(">>> UnDeleteIMAPMessageAction.ExecuteAction");
            if (pairIDs == null)
            {
                return;
            }

            IResource folder = resource.GetLinkProp(PROP.MAPIFolder);

            if (!Folder.IsIMAPFolder(folder))
            {
                return;
            }
            IEMessage message = OutlookSession.OpenMessage(pairIDs.EntryId, pairIDs.StoreId);

            if (message == null)
            {
                return;
            }
            using ( message )
            {
                int tag = message.GetIDsFromNames(ref GUID.set1, lID.msgDeletedInIMAP, PropType.PT_LONG);
                message.DeleteProp(tag);
                OutlookSession.SaveChanges("Undelete message resource id = " + resource.Id, message, pairIDs.EntryId);
            }
            Trace.WriteLine("<<< UnDeleteIMAPMessageAction.ExecuteAction");
        }
예제 #2
0
        private static void ExportAnnotationImpl(IResource emailResource)
        {
            Guard.NullArgument(emailResource, "emailResource");
            if (emailResource.Type != STR.Email)
            {
                throw new ArgumentException("Expected 'Email' resource but was " + emailResource.Type);
            }
            if (Mail.MailInIMAP(emailResource))
            {
                return;
            }

            PairIDs messageIDs = PairIDs.Get(emailResource);

            if (messageIDs == null)
            {
                return;
            }
            IEMessage message = OutlookSession.OpenMessage(messageIDs.EntryId, messageIDs.StoreId);

            if (message == null)
            {
                return;
            }
            using ( message )
            {
                string annotation    = emailResource.GetPropText(Core.Props.Annotation);
                int    tag           = message.GetIDsFromNames(ref GUID.set1, lID.msgFlagAnnotation, PropType.PT_STRING8);
                string oldAnnotation = message.GetStringProp(tag);
                if (oldAnnotation == null)
                {
                    oldAnnotation = string.Empty;
                }
                if (!oldAnnotation.Equals(annotation))
                {
                    if (annotation.Length == 0)
                    {
                        message.DeleteProp(tag);
                    }
                    else
                    {
                        message.SetStringProp(tag, annotation);
                    }
                    OutlookSession.SaveChanges("ExportAnnotation for resource id = " + emailResource.Id, message, messageIDs.EntryId);
                }
            }
        }