当前位置: 首页>>代码示例>>C#>>正文


C# ObjectInstance.GetPropertyValue方法代码示例

本文整理汇总了C#中Jurassic.Library.ObjectInstance.GetPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectInstance.GetPropertyValue方法的具体用法?C# ObjectInstance.GetPropertyValue怎么用?C# ObjectInstance.GetPropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Jurassic.Library.ObjectInstance的用法示例。


在下文中一共展示了ObjectInstance.GetPropertyValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendEmail

        public void SendEmail(ObjectInstance email)
        {
            if (email == null)
                throw new ArgumentNullException("email");

            foreach (var requiredProperty in new[] { "BodyText", "Subject", "Recipients" })
            {
                if (email.HasProperty(requiredProperty))
                    continue;
                throw new ArgumentException(string.Format("Property {0} is mandatory", requiredProperty));
            }

            MailItem newMail = application.CreateItem(OlItemType.olMailItem);

            newMail.Body = email.GetPropertyValue("BodyText").ToString();
            newMail.Subject = email.GetPropertyValue("Subject").ToString();

            var recipients = email.GetPropertyValue("Recipients").ToString().Split(',');

            foreach (var rec in recipients.Select(recipient => newMail.Recipients.Add(recipient)))
                rec.Resolve();

            newMail.Send();
        }
开发者ID:schultyy,项目名称:blackMagic,代码行数:24,代码来源:MailRepositoryInstance.cs

示例2: GetMailsForFolder

        public ArrayInstance GetMailsForFolder(ObjectInstance parameters)
        {
            if (parameters.HasProperty("UniqueId"))
                return GetMailsForFolderInternal(parameters.GetPropertyValue("UniqueId").ToString(), null);

            if (parameters.HasProperty("FolderName"))
            {
                var folderPath = parameters.GetPropertyValue("FolderName").ToString().Split('/');

                if (folderPath.Length != 2)
                    throw new NotSupportedException("At the moment only paths like 'Personal Folders/Foo' are supported");

                var root = folderPath.First();
                var folderName = folderPath.Last();

                var children = GetChildrenFor(root);
                foreach (FolderInstance child in children.ElementValues.Cast<FolderInstance>()
                                                            .Where(child => child.GetPropertyValue("Name").ToString() == folderName))
                    return GetMailsForFolderInternal(child.GetPropertyValue("UniqueId").ToString(), null);
                return Engine.Array.New();
            }

            throw new NotSupportedException(string.Format("Requires an object with either 'UniqueId' or 'FolderName' as parameter"));
        }
开发者ID:schultyy,项目名称:blackMagic,代码行数:24,代码来源:MailRepositoryInstance.cs


注:本文中的Jurassic.Library.ObjectInstance.GetPropertyValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。