Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
WebDAV .NET for Exchange
>
Tutorial
> Remove properties
The following examples shows you how to remove single property or array of properties.
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"; //Remove property PropertyName myPropertyName = new PropertyName("property1", "independentsoft:"); resource.RemoveProperty(contactUrl, myPropertyName); //Remove array of properties PropertyName[] propertyNameArray = new PropertyName[5]; propertyNameArray[0] = new PropertyName("property1", "mynamespace:"); propertyNameArray[1] = new PropertyName("property2", "mynamespace:"); propertyNameArray[2] = new PropertyName("property3", "mynamespace:"); propertyNameArray[3] = new PropertyName("property4", "mynamespace:"); propertyNameArray[4] = new PropertyName("property5", "mynamespace:"); resource.RemoveProperty(contactUrl, propertyNameArray); } } }
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" 'Remove property Dim myPropertyName As PropertyName = New PropertyName("property1", "independentsoft:") resource.RemoveProperty(contactUrl, myPropertyName) 'Remove array of properties Dim propertyNameArray() As PropertyName = New PropertyName(4) {} propertyNameArray(0) = New PropertyName("property1", "mynamespace:") propertyNameArray(1) = New PropertyName("property2", "mynamespace:") propertyNameArray(2) = New PropertyName("property3", "mynamespace:") propertyNameArray(3) = New PropertyName("property4", "mynamespace:") propertyNameArray(4) = New PropertyName("property5", "mynamespace:") resource.RemoveProperty(contactUrl, propertyNameArray) End Sub End Module