本文整理汇总了C#中PropertySet类的典型用法代码示例。如果您正苦于以下问题:C# PropertySet类的具体用法?C# PropertySet怎么用?C# PropertySet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertySet类属于命名空间,在下文中一共展示了PropertySet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckMail
public void CheckMail()
{
try
{
string processLoc = dataActionsObject.getProcessingFolderLocation();
StreamWriter st = new StreamWriter("C:\\Test\\_testings.txt");
string emailId = "[email protected]";// ConfigurationManager.AppSettings["UserName"].ToString();
if (emailId != string.Empty)
{
st.WriteLine(DateTime.Now + " " + emailId);
st.Close();
ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials(emailId, "Sea2013");
service.UseDefaultCredentials = false;
service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
Folder inbox = Folder.Bind(service, WellKnownFolderName.Inbox);
SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));
if (inbox.UnreadCount > 0)
{
ItemView view = new ItemView(inbox.UnreadCount);
FindItemsResults<Item> findResults = inbox.FindItems(sf, view);
PropertySet itempropertyset = new PropertySet(BasePropertySet.FirstClassProperties, EmailMessageSchema.From, EmailMessageSchema.ToRecipients);
itempropertyset.RequestedBodyType = BodyType.Text;
//inbox.UnreadCount
ServiceResponseCollection<GetItemResponse> items = service.BindToItems(findResults.Select(item => item.Id), itempropertyset);
MailItem[] msit = getMailItem(items, service);
foreach (MailItem item in msit)
{
item.message.IsRead = true;
item.message.Update(ConflictResolutionMode.AlwaysOverwrite);
foreach (Attachment attachment in item.attachment)
{
if (attachment is FileAttachment)
{
string extName = attachment.Name.Substring(attachment.Name.LastIndexOf('.'));
FileAttachment fileAttachment = attachment as FileAttachment;
FileStream theStream = new FileStream(processLoc + fileAttachment.Name, FileMode.OpenOrCreate, FileAccess.ReadWrite);
fileAttachment.Load(theStream);
byte[] fileContents;
MemoryStream memStream = new MemoryStream();
theStream.CopyTo(memStream);
fileContents = memStream.GetBuffer();
theStream.Close();
theStream.Dispose();
Console.WriteLine("Attachment name: " + fileAttachment.Name + fileAttachment.Content + fileAttachment.ContentType + fileAttachment.Size);
}
}
}
}
DeleteMail(emailId);
}
}
catch (Exception ex)
{
}
}
示例2: Bind
/// <summary>
/// Binds to an existing e-mail message and loads the specified set of properties.
/// Calling this method results in a call to EWS.
/// </summary>
/// <param name="service">The service to use to bind to the e-mail message.</param>
/// <param name="id">The Id of the e-mail message to bind to.</param>
/// <param name="propertySet">The set of properties to load.</param>
/// <returns>An EmailMessage instance representing the e-mail message corresponding to the specified Id.</returns>
public static new EmailMessage Bind(
ExchangeService service,
ItemId id,
PropertySet propertySet)
{
return service.BindToItem<EmailMessage>(id, propertySet);
}
示例3: ExportItem
internal void ExportItem()
{
if (this.ItemToExport.GetType().Name.ToString() != "EmailMessage")
throw new InvalidOperationException("Please provide item typeof EmailMessage.");
ExchangeService ewsSession = this.GetSessionVariable();
PropertySet propertySet = new PropertySet(EmailMessageSchema.MimeContent);
propertySet.Add(EmailMessageSchema.ConversationTopic);
EmailMessage emailMessage = EmailMessage.Bind(ewsSession, this.ItemToExport.Id, propertySet);
Random rNumber = new Random();
string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "EmailExport");
if (!Directory.Exists(directory))
Directory.CreateDirectory(directory);
if (string.IsNullOrEmpty(this.fileName))
{
int subjectLenght = emailMessage.ConversationTopic.Length > 10 ? 10 : emailMessage.ConversationTopic.Length;
fileName = String.Format( "Email-{0}-{1}" , emailMessage.ConversationTopic.Substring( 0 , subjectLenght ) , rNumber.Next( 1 , 10 ) );
}
fileName = Path.Combine(directory, string.Format("{0}.eml", fileName));
using (FileStream fileStream = new FileStream(fileName, FileMode.Create, FileAccess.Write))
{
fileStream.Write(emailMessage.MimeContent.Content, 0, emailMessage.MimeContent.Content.Length);
}
}
示例4: axMapControl1_OnMouseDown
private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
{
//IMapDocument mxd;
string x;
x = e.mapX.ToString("#########.########");
string y;
y = e.mapY.ToString("#########.########");
string data;
data = "";
data += string.Format("The map has x coordinate {0} \n y coordinate {1}", x, y);
Form1 msgForm = new Form1();
msgForm.label1.Text = data;
//msgForm.ShowDialog();
IPropertySet location = new PropertySet();
location.SetProperty("ps","C:\\Users\\AlexanderN\\Documents\\ArcGIS\\Points.gdb");
string featureBuffer = "C:\\Users\\AlexanderN\\Documents\\ArcGIS\\Points.gdb\\Buffer";
string featurePoint = "C:\\Users\\AlexanderN\\Documents\\ArcGIS\\Points.gdb\\AdditionalPoint";
IFeatureWorkspace ws;
IFeature newPoint = ws.OpenFeatureClass(featurePoint) as IFeature;
IFeature newBuffer = ws.OpenFeatureClass(featureBuffer) as IFeature;
Geom.IPoint point = new Geom.PointClass();
point.PutCoords(e.mapX, e.mapY);
newPoint.Shape = point;
IFeatureClass pointFC = newPoint as IFeatureClass;
newPoint.Store();
}
示例5: Bind
/// <summary>
/// Binds to an existing meeting request and loads the specified set of properties.
/// Calling this method results in a call to EWS.
/// </summary>
/// <param name="service">The service to use to bind to the meeting request.</param>
/// <param name="id">The Id of the meeting request to bind to.</param>
/// <param name="propertySet">The set of properties to load.</param>
/// <returns>A MeetingRequest instance representing the meeting request corresponding to the specified Id.</returns>
public static new MeetingRequest Bind(
ExchangeService service,
ItemId id,
PropertySet propertySet)
{
return service.BindToItem<MeetingRequest>(id, propertySet);
}
示例6: Bind
/// <summary>
/// Binds to an existing task and loads the specified set of properties.
/// Calling this method results in a call to EWS.
/// </summary>
/// <param name="service">The service to use to bind to the task.</param>
/// <param name="id">The Id of the task to bind to.</param>
/// <param name="propertySet">The set of properties to load.</param>
/// <returns>A Task instance representing the task corresponding to the specified Id.</returns>
public static new Task Bind(
ExchangeService service,
ItemId id,
PropertySet propertySet)
{
return service.BindToItem<Task>(id, propertySet);
}
示例7: GetCalendarEvents
/// <summary>
/// Returns a list of events given the start and end time, inclusive.
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
public IEnumerable<ICalendarEvent> GetCalendarEvents(DateTimeOffset startDate, DateTimeOffset endDate)
{
// Initialize the calendar folder object with only the folder ID.
var propertiesToGet = new PropertySet(PropertySet.IdOnly);
propertiesToGet.RequestedBodyType = BodyType.Text;
var calendar = CalendarFolder.Bind(_exchangeService, WellKnownFolderName.Calendar, propertiesToGet);
// Set the start and end time and number of appointments to retrieve.
var calendarView = new CalendarView(
startDate.ToOffset(_exchangeService.TimeZone.BaseUtcOffset).DateTime,
endDate.ToOffset(_exchangeService.TimeZone.BaseUtcOffset).DateTime,
MAX_EVENTS_TO_RETRIEVE);
// Retrieve a collection of appointments by using the calendar view.
var appointments = calendar.FindAppointments(calendarView);
// Get specific properties.
var appointmentSpecificPropertiesToGet = new PropertySet(PropertySet.FirstClassProperties);
appointmentSpecificPropertiesToGet.AddRange(NonFirstClassAppointmentProperties);
appointmentSpecificPropertiesToGet.RequestedBodyType = BodyType.Text;
_exchangeService.LoadPropertiesForItems(appointments, appointmentSpecificPropertiesToGet);
return TransformExchangeAppointmentsToGenericEvents(appointments);
}
示例8: createTestVirtualDocument
private void createTestVirtualDocument()
{
// create a new DataObject to use as the parent node
ObjectIdentity emptyIdentity = new ObjectIdentity(DefaultRepository);
DataObject parentDO = new DataObject(emptyIdentity);
parentDO.Type = "dm_document";
PropertySet parentProperties = new PropertySet();
parentProperties.Set("object_name", SampleContentManager.testVdmObjectName);
parentDO.Properties = parentProperties;
// link into a folder
ObjectPath objectPath = new ObjectPath(SampleContentManager.sourcePath);
ObjectIdentity sampleFolderIdentity = new ObjectIdentity(objectPath, DefaultRepository);
ReferenceRelationship sampleFolderRelationship = new ReferenceRelationship();
sampleFolderRelationship.Name = Relationship.RELATIONSHIP_FOLDER;
sampleFolderRelationship.Target = sampleFolderIdentity;
sampleFolderRelationship.TargetRole = Relationship.ROLE_PARENT;
parentDO.Relationships.Add(sampleFolderRelationship);
// get id of document to use for first child node
ObjectIdentity child0Id = new ObjectIdentity();
child0Id.RepositoryName = DefaultRepository;
child0Id.Value = new Qualification(SampleContentManager.gifImageQualString);
// get id of document to use for second child node
ObjectIdentity child1Id = new ObjectIdentity();
child1Id.RepositoryName = DefaultRepository;
child1Id.Value = new Qualification(SampleContentManager.gifImage1QualString);
ObjectIdentitySet childNodes = new ObjectIdentitySet();
childNodes.AddIdentity(child0Id);
childNodes.AddIdentity(child1Id);
virtualDocumentServiceDemo.AddChildNodes(parentDO, childNodes);
}
示例9: ShowNumberProperties
public void ShowNumberProperties()
{
PropertySet propertySet = new PropertySet();
//Create instances of NumberProperty
propertySet.Set("TestShortName", (short) 10);
propertySet.Set("TestIntegerName", 10);
propertySet.Set("TestLongName", 10L);
propertySet.Set("TestDoubleName", 10.10);
//Create instance of DateProperty
propertySet.Set("TestDateName", new DateTime());
//Create instance of BooleanProperty
propertySet.Set("TestBooleanName", false);
//Create instance of ObjectIdProperty
propertySet.Set("TestObjectIdName", new ObjectId("10"));
List<Property> properties = propertySet.Properties;
foreach (Property p in properties)
{
Console.WriteLine(typeof(Property).ToString() +
" = " +
p.GetValueAsString());
}
}
示例10: Bind
/// <summary>
/// Binds to an existing meeting cancellation message and loads the specified set of properties.
/// Calling this method results in a call to EWS.
/// </summary>
/// <param name="service">The service to use to bind to the meeting cancellation message.</param>
/// <param name="id">The Id of the meeting cancellation message to bind to.</param>
/// <param name="propertySet">The set of properties to load.</param>
/// <returns>A MeetingCancellation instance representing the meeting cancellation message corresponding to the specified Id.</returns>
public static new MeetingCancellation Bind(
ExchangeService service,
ItemId id,
PropertySet propertySet)
{
return service.BindToItem<MeetingCancellation>(id, propertySet);
}
示例11: Bind
/// <summary>
/// Binds to an existing appointment and loads the specified set of properties.
/// Calling this method results in a call to EWS.
/// </summary>
/// <param name="service">The service to use to bind to the appointment.</param>
/// <param name="id">The Id of the appointment to bind to.</param>
/// <param name="propertySet">The set of properties to load.</param>
/// <returns>An Appointment instance representing the appointment corresponding to the specified Id.</returns>
public static new Appointment Bind(
ExchangeService service,
ItemId id,
PropertySet propertySet)
{
return service.BindToItem<Appointment>(id, propertySet);
}
示例12: Bind
/// <summary>
/// Binds to an existing contact and loads the specified set of properties.
/// Calling this method results in a call to EWS.
/// </summary>
/// <param name="service">The service to use to bind to the contact.</param>
/// <param name="id">The Id of the contact to bind to.</param>
/// <param name="propertySet">The set of properties to load.</param>
/// <returns>A Contact instance representing the contact corresponding to the specified Id.</returns>
public static new Contact Bind(
ExchangeService service,
ItemId id,
PropertySet propertySet)
{
return service.BindToItem<Contact>(id, propertySet);
}
示例13: Bind
/// <summary>
/// Binds to an existing calendar folder and loads the specified set of properties.
/// Calling this method results in a call to EWS.
/// </summary>
/// <param name="service">The service to use to bind to the calendar folder.</param>
/// <param name="id">The Id of the calendar folder to bind to.</param>
/// <param name="propertySet">The set of properties to load.</param>
/// <returns>A CalendarFolder instance representing the calendar folder corresponding to the specified Id.</returns>
public static new CalendarFolder Bind(
ExchangeService service,
FolderId id,
PropertySet propertySet)
{
return service.BindToFolder<CalendarFolder>(id, propertySet);
}
示例14: TestPackage
/// <summary>
/// Creates an empty test package.
/// </summary>
public TestPackage()
{
files = new List<FileInfo>();
hintDirectories = new List<DirectoryInfo>();
excludedTestFrameworkIds = new List<string>();
properties = new PropertySet();
}
示例15: Bind
/// <summary>
/// Binds to an existing item, whatever its actual type is, and loads the specified set of properties.
/// Calling this method results in a call to EWS.
/// </summary>
/// <param name="service">The service to use to bind to the item.</param>
/// <param name="id">The Id of the item to bind to.</param>
/// <param name="propertySet">The set of properties to load.</param>
/// <returns>An Item instance representing the item corresponding to the specified Id.</returns>
public static Item Bind(
ExchangeService service,
ItemId id,
PropertySet propertySet)
{
return service.BindToItem<Item>(id, propertySet);
}