Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
WebDAV .NET for Exchange
>
Tutorial
> Get properties
The following example shows you how to retrieve property value.
C# example
using System; using System.Net; using Independentsoft.Webdav.Exchange; using Independentsoft.Webdav.Exchange.ContentClass; using Independentsoft.Webdav.Exchange.Properties; namespace Sample { class Program { static void Main(string[] args) { NetworkCredential credential = new NetworkCredential("username", "password"); WebdavSession session = new WebdavSession(credential); session.UserMailbox = "https://myserver/exchange/emailaddress"; Resource resource = new Resource(session); string contactUrl = "https://myserver/exchange/emailaddress/Contacts/John.eml"; //Get contact's City property Property cityProperty = resource.GetProperty(contactUrl, ContactProperty.City); Console.WriteLine("City = " + cityProperty.Value); //Get custom property PropertyName myPropertyName = new PropertyName("property1", "independentsoft:"); Property myProperty = resource.GetProperty(contactUrl, myPropertyName); Console.WriteLine("MyProperty = " + myProperty.Value); Console.Read(); } } }
VB example
Imports System Imports System.Net Imports Independentsoft.Webdav.Exchange Imports Independentsoft.Webdav.Exchange.ContentClass Imports Independentsoft.Webdav.Exchange.Properties Module Module1 Sub Main(ByVal args() As String) Dim credential As NetworkCredential = New NetworkCredential("username", "password") Dim session As WebdavSession = New WebdavSession(credential) session.UserMailbox = "https://myserver/exchange/emailaddress" Dim resource As Resource = New Resource(session) Dim contactUrl As String = "https://myserver/exchange/emailaddress/Contacts/John.eml" 'Get contact's City property Dim cityProperty As Independentsoft.Webdav.Exchange.Property = resource.GetProperty(contactUrl, ContactProperty.City) Console.WriteLine("City = " & cityProperty.Value) 'Get custom property Dim myPropertyName As PropertyName = New PropertyName("property1", "independentsoft:") Dim myProperty As Independentsoft.Webdav.Exchange.Property = resource.GetProperty(contactUrl, myPropertyName) Console.WriteLine("MyProperty = " & myProperty.Value) Console.Read() End Sub End Module