本文整理汇总了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();
}
示例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"));
}