| Author |
Message |
Lorenzo Soncini
Guest
|
Posted:
Tue Sep 27, 2005 4:58 pm Post subject:
Create exchnage task |
|
|
Hy,
how can I create a task in a public folder using .NET ?
Lorenzo Soncini
|
|
| Back to top |
|
 |
Glen Scales [MVP]
Guest
|
Posted:
Thu Sep 29, 2005 12:58 am Post subject:
Re: Create exchnage task |
|
|
There are two methods you could use both are kind of work arounds because
none of the current Exchange API's really support task. If you can run your
code locally then you could create interop dlls for CDOEX and ADODB then use
Exoledb to create the tasks. Otherwise you can use the native .NET classes
and use WebDAV to create the tasks which will work remotely. Eg something
like this should work (this is base on a SDK sample for creating
appointments via webdav
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_esdk_creating_an_appointment_webdav.asp)
{
// Variables.
string strExchSvrName = "";
string strMailbox = "";
string strTaskUri = "";
string strTaskItem = "";
string strDomain = "";
string strUserName = "";
string strPassword = "";
string strApptRequest = "";
string strMailInfo = "";
string strTaskInfo = "";
string strXMLNSInfo = "";
string strHeaderInfo = "";
System.Net.HttpWebRequest PROPPATCHRequest = null;
System.Net.WebResponse PROPPATCHResponse = null;
System.Net.CredentialCache MyCredentialCache = null;
byte[] bytes = null;
System.IO.Stream PROPPATCHRequestStream = null;
try
{
strExchSvrName = "servername";
strMailbox = "mailbox";
strTaskItem = "testtask.eml";
strTaskUri = "http://" + strExchSvrName + "/exchange/"
+ strMailbox + "/tasks/";
// User name and password of appointment creator.
strUserName = "user";
strDomain = "domain";
strPassword = "password";
// XML namespace info for the WebDAV request.
strXMLNSInfo = "xmlns:g=\"DAV:\" "
+ "xmlns:e=\"http://schemas.microsoft.com/exchange/\" "
+ "xmlns:mapi=\"http://schemas.microsoft.com/mapi/\" "
+ "xmlns:mapit=\"http://schemas.microsoft.com/mapi/proptag/\" "
+ "xmlns:dt=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" "
+
"xmlns:h=\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/\"
"
+
"xmlns:i=\"http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/\"
"
+ "xmlns:header=\"urn:schemas:mailheader:\" "
+ "xmlns:mail=\"urn:schemas:httpmail:\"";
strTaskInfo = "<h:0x00008104
dt:dt=\"dateTime.tz\">2005-09-29T00:00:00Z</h:0x00008104>"
+ "<h:0x00008105
dt:dt=\"dateTime.tz\">2005-09-29T00:00:00Z</h:0x00008105>"
+ "<h:0x0000811C dt:dt=\"boolean\">0</h:0x0000811C>"
+ "<h:0x00008101 dt:dt=\"int\">0</h:0x00008101>"
+ "<h:0x00008102 dt:dt=\"float\">0</h:0x00008102>"
+ "<i:0x00008503 dt:dt=\"boolean\">1</i:0x00008503>";
strHeaderInfo = "<header:to>" + strMailbox + "</header:to>";
strMailInfo = "<mail:subject>Test Task Subject</mail:subject>"
+ "<mail:htmldescription>Test Description</mail:htmldescription>";
// Build the XML body of the PROPPATCH request.
strApptRequest = "<?xml version=\"1.0\"?>"
+ "<g:propertyupdate " + strXMLNSInfo + ">"
+ "<g:set><g:prop>"
+ "<g:contentclass>urn:content-classes:task</g:contentclass>"
+ "<e:outlookmessageclass>IPM.Task</e:outlookmessageclass>"
+ strMailInfo
+ strTaskInfo
+ strHeaderInfo
+ "</g:prop></g:set>"
+ "</g:propertyupdate>";
MyCredentialCache = new System.Net.CredentialCache();
MyCredentialCache.Add( new System.Uri(strTaskUri),
"NTLM",
new System.Net.NetworkCredential(strUserName, strPassword, strDomain)
);
PROPPATCHRequest =
(System.Net.HttpWebRequest)HttpWebRequest.Create(strTaskUri + strTaskItem);
PROPPATCHRequest.Credentials = MyCredentialCache;
PROPPATCHRequest.Method = "PROPPATCH";
bytes = Encoding.UTF8.GetBytes((string)strApptRequest);
PROPPATCHRequest.ContentLength = bytes.Length;
PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();
PROPPATCHRequestStream.Write(bytes, 0, bytes.Length);
PROPPATCHRequestStream.Close();
PROPPATCHRequest.ContentType = "text/xml";
PROPPATCHResponse =
(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();
PROPPATCHResponse.Close();
Console.WriteLine("Task successfully created.");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Cheers
Glen
"Lorenzo Soncini" <lorenzo.soncini@technoservice.com> wrote in message
news:Or0af01wFHA.3860@TK2MSFTNGP09.phx.gbl...
| Quote: | Hy,
how can I create a task in a public folder using .NET ?
Lorenzo Soncini
|
|
|
| Back to top |
|
 |
Alex
Guest
|
Posted:
Thu Sep 29, 2005 4:58 pm Post subject:
Re: Create exchnage task |
|
|
Glen,
Maybe I am missing something, but why not look the OOM?
Try this code:
{
Outlook.ApplicationClass oApp = new Outlook.ApplicationClass();
Outlook.NameSpace oNS = oApp.GetNamespace( "MAPI" );
Outlook.MAPIFolder oFolder = oNS.GetDefaultFolder(
Outlook.OlDefaultFolders.olPublicFoldersAllPublicFolders );
Outlook.MAPIFolder oPublicTaskFolder = oFolder.Items.Item(
"MyPublicTaskFolder" );
Outlook._Items oItems = oPublicTaskFolder.Items;
Outlook._TaskItem oTask = (Outlook._TaskItem) oItems.Add(
"IPM.Task" );
oTask.Subject = "My Subject";
oTask.Body = "Notes and other text go here";
oTask.StartDAte = DateTime.Now;
oTask.DueDate = DateTime.Now.AddDays(7); //Due a week from now
oTask.Save();
// et voila!
// now clean up and you're set to go.
oTask = null;
oApp = null;
GC.WaitForPendingFinalizers();
GC.Collect();
}
You'd need to add Outlook to your references.
Alex
"Glen Scales [MVP]" <gscales@outlookexchange.com> wrote in message
news:eRfaF4IxFHA.3720@TK2MSFTNGP11.phx.gbl...
| Quote: | There are two methods you could use both are kind of work arounds because
none of the current Exchange API's really support task. If you can run
your code locally then you could create interop dlls for CDOEX and ADODB
then use Exoledb to create the tasks. Otherwise you can use the native
.NET classes and use WebDAV to create the tasks which will work remotely.
Eg something like this should work (this is base on a SDK sample for
creating appointments via webdav
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_esdk_creating_an_appointment_webdav.asp)
{
// Variables.
string strExchSvrName = "";
string strMailbox = "";
string strTaskUri = "";
string strTaskItem = "";
string strDomain = "";
string strUserName = "";
string strPassword = "";
string strApptRequest = "";
string strMailInfo = "";
string strTaskInfo = "";
string strXMLNSInfo = "";
string strHeaderInfo = "";
System.Net.HttpWebRequest PROPPATCHRequest = null;
System.Net.WebResponse PROPPATCHResponse = null;
System.Net.CredentialCache MyCredentialCache = null;
byte[] bytes = null;
System.IO.Stream PROPPATCHRequestStream = null;
try
{
strExchSvrName = "servername";
strMailbox = "mailbox";
strTaskItem = "testtask.eml";
strTaskUri = "http://" + strExchSvrName + "/exchange/"
+ strMailbox + "/tasks/";
// User name and password of appointment creator.
strUserName = "user";
strDomain = "domain";
strPassword = "password";
// XML namespace info for the WebDAV request.
strXMLNSInfo = "xmlns:g=\"DAV:\" "
+ "xmlns:e=\"http://schemas.microsoft.com/exchange/\" "
+ "xmlns:mapi=\"http://schemas.microsoft.com/mapi/\" "
+ "xmlns:mapit=\"http://schemas.microsoft.com/mapi/proptag/\" "
+ "xmlns:dt=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" "
+
"xmlns:h=\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/\"
"
+
"xmlns:i=\"http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/\"
"
+ "xmlns:header=\"urn:schemas:mailheader:\" "
+ "xmlns:mail=\"urn:schemas:httpmail:\"";
strTaskInfo = "<h:0x00008104
dt:dt=\"dateTime.tz\">2005-09-29T00:00:00Z</h:0x00008104>"
+ "<h:0x00008105
dt:dt=\"dateTime.tz\">2005-09-29T00:00:00Z</h:0x00008105>"
+ "<h:0x0000811C dt:dt=\"boolean\">0</h:0x0000811C>"
+ "<h:0x00008101 dt:dt=\"int\">0</h:0x00008101>"
+ "<h:0x00008102 dt:dt=\"float\">0</h:0x00008102>"
+ "<i:0x00008503 dt:dt=\"boolean\">1</i:0x00008503>";
strHeaderInfo = "<header:to>" + strMailbox + "</header:to>";
strMailInfo = "<mail:subject>Test Task Subject</mail:subject>"
+ "<mail:htmldescription>Test Description</mail:htmldescription>";
// Build the XML body of the PROPPATCH request.
strApptRequest = "<?xml version=\"1.0\"?>"
+ "<g:propertyupdate " + strXMLNSInfo + ">"
+ "<g:set><g:prop>"
+ "<g:contentclass>urn:content-classes:task</g:contentclass>"
+ "<e:outlookmessageclass>IPM.Task</e:outlookmessageclass>"
+ strMailInfo
+ strTaskInfo
+ strHeaderInfo
+ "</g:prop></g:set>"
+ "</g:propertyupdate>";
MyCredentialCache = new System.Net.CredentialCache();
MyCredentialCache.Add( new System.Uri(strTaskUri),
"NTLM",
new System.Net.NetworkCredential(strUserName, strPassword, strDomain)
);
PROPPATCHRequest =
(System.Net.HttpWebRequest)HttpWebRequest.Create(strTaskUri +
strTaskItem);
PROPPATCHRequest.Credentials = MyCredentialCache;
PROPPATCHRequest.Method = "PROPPATCH";
bytes = Encoding.UTF8.GetBytes((string)strApptRequest);
PROPPATCHRequest.ContentLength = bytes.Length;
PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();
PROPPATCHRequestStream.Write(bytes, 0, bytes.Length);
PROPPATCHRequestStream.Close();
PROPPATCHRequest.ContentType = "text/xml";
PROPPATCHResponse =
(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();
PROPPATCHResponse.Close();
Console.WriteLine("Task successfully created.");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Cheers
Glen
"Lorenzo Soncini" <lorenzo.soncini@technoservice.com> wrote in message
news:Or0af01wFHA.3860@TK2MSFTNGP09.phx.gbl...
Hy,
how can I create a task in a public folder using .NET ?
Lorenzo Soncini
|
|
|
| Back to top |
|
 |
Glen Scales [MVP]
Guest
|
Posted:
Fri Sep 30, 2005 12:58 am Post subject:
Re: Create exchnage task |
|
|
Nice code thanks for sharing that's a good point OOM is the only currently
supported API that allows you to create tasks. The main problem with OOM
however is that its not suitable for use in Automation code so its not a
good choice if you want to use it say in a ASP.NET application.But if you
dont have those problems its a good choice.
Cheers
Glen
"Alex" <Alex.Avid@newsgroups.nospam> wrote in message
news:eaSIPPQxFHA.2620@TK2MSFTNGP09.phx.gbl...
| Quote: | Glen,
Maybe I am missing something, but why not look the OOM?
Try this code:
{
Outlook.ApplicationClass oApp = new Outlook.ApplicationClass();
Outlook.NameSpace oNS = oApp.GetNamespace( "MAPI" );
Outlook.MAPIFolder oFolder = oNS.GetDefaultFolder(
Outlook.OlDefaultFolders.olPublicFoldersAllPublicFolders );
Outlook.MAPIFolder oPublicTaskFolder = oFolder.Items.Item(
"MyPublicTaskFolder" );
Outlook._Items oItems = oPublicTaskFolder.Items;
Outlook._TaskItem oTask = (Outlook._TaskItem) oItems.Add(
"IPM.Task" );
oTask.Subject = "My Subject";
oTask.Body = "Notes and other text go here";
oTask.StartDAte = DateTime.Now;
oTask.DueDate = DateTime.Now.AddDays(7); //Due a week from now
oTask.Save();
// et voila!
// now clean up and you're set to go.
oTask = null;
oApp = null;
GC.WaitForPendingFinalizers();
GC.Collect();
}
You'd need to add Outlook to your references.
Alex
"Glen Scales [MVP]" <gscales@outlookexchange.com> wrote in message
news:eRfaF4IxFHA.3720@TK2MSFTNGP11.phx.gbl...
There are two methods you could use both are kind of work arounds because
none of the current Exchange API's really support task. If you can run
your code locally then you could create interop dlls for CDOEX and ADODB
then use Exoledb to create the tasks. Otherwise you can use the native
.NET classes and use WebDAV to create the tasks which will work remotely.
Eg something like this should work (this is base on a SDK sample for
creating appointments via webdav
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_esdk_creating_an_appointment_webdav.asp)
{
// Variables.
string strExchSvrName = "";
string strMailbox = "";
string strTaskUri = "";
string strTaskItem = "";
string strDomain = "";
string strUserName = "";
string strPassword = "";
string strApptRequest = "";
string strMailInfo = "";
string strTaskInfo = "";
string strXMLNSInfo = "";
string strHeaderInfo = "";
System.Net.HttpWebRequest PROPPATCHRequest = null;
System.Net.WebResponse PROPPATCHResponse = null;
System.Net.CredentialCache MyCredentialCache = null;
byte[] bytes = null;
System.IO.Stream PROPPATCHRequestStream = null;
try
{
strExchSvrName = "servername";
strMailbox = "mailbox";
strTaskItem = "testtask.eml";
strTaskUri = "http://" + strExchSvrName + "/exchange/"
+ strMailbox + "/tasks/";
// User name and password of appointment creator.
strUserName = "user";
strDomain = "domain";
strPassword = "password";
// XML namespace info for the WebDAV request.
strXMLNSInfo = "xmlns:g=\"DAV:\" "
+ "xmlns:e=\"http://schemas.microsoft.com/exchange/\" "
+ "xmlns:mapi=\"http://schemas.microsoft.com/mapi/\" "
+ "xmlns:mapit=\"http://schemas.microsoft.com/mapi/proptag/\" "
+ "xmlns:dt=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" "
+
"xmlns:h=\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/\"
"
+
"xmlns:i=\"http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/\"
"
+ "xmlns:header=\"urn:schemas:mailheader:\" "
+ "xmlns:mail=\"urn:schemas:httpmail:\"";
strTaskInfo = "<h:0x00008104
dt:dt=\"dateTime.tz\">2005-09-29T00:00:00Z</h:0x00008104>"
+ "<h:0x00008105
dt:dt=\"dateTime.tz\">2005-09-29T00:00:00Z</h:0x00008105>"
+ "<h:0x0000811C dt:dt=\"boolean\">0</h:0x0000811C>"
+ "<h:0x00008101 dt:dt=\"int\">0</h:0x00008101>"
+ "<h:0x00008102 dt:dt=\"float\">0</h:0x00008102>"
+ "<i:0x00008503 dt:dt=\"boolean\">1</i:0x00008503>";
strHeaderInfo = "<header:to>" + strMailbox + "</header:to>";
strMailInfo = "<mail:subject>Test Task Subject</mail:subject>"
+ "<mail:htmldescription>Test Description</mail:htmldescription>";
// Build the XML body of the PROPPATCH request.
strApptRequest = "<?xml version=\"1.0\"?>"
+ "<g:propertyupdate " + strXMLNSInfo + ">"
+ "<g:set><g:prop>"
+ "<g:contentclass>urn:content-classes:task</g:contentclass>"
+ "<e:outlookmessageclass>IPM.Task</e:outlookmessageclass>"
+ strMailInfo
+ strTaskInfo
+ strHeaderInfo
+ "</g:prop></g:set>"
+ "</g:propertyupdate>";
MyCredentialCache = new System.Net.CredentialCache();
MyCredentialCache.Add( new System.Uri(strTaskUri),
"NTLM",
new System.Net.NetworkCredential(strUserName, strPassword, strDomain)
);
PROPPATCHRequest =
(System.Net.HttpWebRequest)HttpWebRequest.Create(strTaskUri +
strTaskItem);
PROPPATCHRequest.Credentials = MyCredentialCache;
PROPPATCHRequest.Method = "PROPPATCH";
bytes = Encoding.UTF8.GetBytes((string)strApptRequest);
PROPPATCHRequest.ContentLength = bytes.Length;
PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();
PROPPATCHRequestStream.Write(bytes, 0, bytes.Length);
PROPPATCHRequestStream.Close();
PROPPATCHRequest.ContentType = "text/xml";
PROPPATCHResponse =
(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();
PROPPATCHResponse.Close();
Console.WriteLine("Task successfully created.");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Cheers
Glen
"Lorenzo Soncini" <lorenzo.soncini@technoservice.com> wrote in message
news:Or0af01wFHA.3860@TK2MSFTNGP09.phx.gbl...
Hy,
how can I create a task in a public folder using .NET ?
Lorenzo Soncini
|
|
|
| Back to top |
|
 |
Alex
Guest
|
Posted:
Fri Sep 30, 2005 4:58 pm Post subject:
Re: Create exchnage task |
|
|
I see. Well, I have a winform App, in C#... and this code works fine for me.
One thing I am trying to get that is the Contacts selected by the user.
For some reason OOM exposes both Contats and ContactNames as string, but
when I look at Contacts property is gives me gibberish... I am guessing it
should be a collection of sorts..
Alex
"Glen Scales [MVP]" <gscales@outlookexchange.com> wrote in message
news:upwS3UUxFHA.1148@TK2MSFTNGP11.phx.gbl...
| Quote: | Nice code thanks for sharing that's a good point OOM is the only currently
supported API that allows you to create tasks. The main problem with OOM
however is that its not suitable for use in Automation code so its not a
good choice if you want to use it say in a ASP.NET application.But if you
dont have those problems its a good choice.
Cheers
Glen
"Alex" <Alex.Avid@newsgroups.nospam> wrote in message
news:eaSIPPQxFHA.2620@TK2MSFTNGP09.phx.gbl...
Glen,
Maybe I am missing something, but why not look the OOM?
Try this code:
{
Outlook.ApplicationClass oApp = new Outlook.ApplicationClass();
Outlook.NameSpace oNS = oApp.GetNamespace( "MAPI" );
Outlook.MAPIFolder oFolder = oNS.GetDefaultFolder(
Outlook.OlDefaultFolders.olPublicFoldersAllPublicFolders );
Outlook.MAPIFolder oPublicTaskFolder = oFolder.Items.Item(
"MyPublicTaskFolder" );
Outlook._Items oItems = oPublicTaskFolder.Items;
Outlook._TaskItem oTask = (Outlook._TaskItem) oItems.Add(
"IPM.Task" );
oTask.Subject = "My Subject";
oTask.Body = "Notes and other text go here";
oTask.StartDAte = DateTime.Now;
oTask.DueDate = DateTime.Now.AddDays(7); //Due a week from now
oTask.Save();
// et voila!
// now clean up and you're set to go.
oTask = null;
oApp = null;
GC.WaitForPendingFinalizers();
GC.Collect();
}
You'd need to add Outlook to your references.
Alex
"Glen Scales [MVP]" <gscales@outlookexchange.com> wrote in message
news:eRfaF4IxFHA.3720@TK2MSFTNGP11.phx.gbl...
There are two methods you could use both are kind of work arounds
because none of the current Exchange API's really support task. If you
can run your code locally then you could create interop dlls for CDOEX
and ADODB then use Exoledb to create the tasks. Otherwise you can use
the native .NET classes and use WebDAV to create the tasks which will
work remotely. Eg something like this should work (this is base on a SDK
sample for creating appointments via webdav
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_esdk_creating_an_appointment_webdav.asp)
{
// Variables.
string strExchSvrName = "";
string strMailbox = "";
string strTaskUri = "";
string strTaskItem = "";
string strDomain = "";
string strUserName = "";
string strPassword = "";
string strApptRequest = "";
string strMailInfo = "";
string strTaskInfo = "";
string strXMLNSInfo = "";
string strHeaderInfo = "";
System.Net.HttpWebRequest PROPPATCHRequest = null;
System.Net.WebResponse PROPPATCHResponse = null;
System.Net.CredentialCache MyCredentialCache = null;
byte[] bytes = null;
System.IO.Stream PROPPATCHRequestStream = null;
try
{
strExchSvrName = "servername";
strMailbox = "mailbox";
strTaskItem = "testtask.eml";
strTaskUri = "http://" + strExchSvrName + "/exchange/"
+ strMailbox + "/tasks/";
// User name and password of appointment creator.
strUserName = "user";
strDomain = "domain";
strPassword = "password";
// XML namespace info for the WebDAV request.
strXMLNSInfo = "xmlns:g=\"DAV:\" "
+ "xmlns:e=\"http://schemas.microsoft.com/exchange/\" "
+ "xmlns:mapi=\"http://schemas.microsoft.com/mapi/\" "
+ "xmlns:mapit=\"http://schemas.microsoft.com/mapi/proptag/\" "
+ "xmlns:dt=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" "
+
"xmlns:h=\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/\"
"
+
"xmlns:i=\"http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/\"
"
+ "xmlns:header=\"urn:schemas:mailheader:\" "
+ "xmlns:mail=\"urn:schemas:httpmail:\"";
strTaskInfo = "<h:0x00008104
dt:dt=\"dateTime.tz\">2005-09-29T00:00:00Z</h:0x00008104>"
+ "<h:0x00008105
dt:dt=\"dateTime.tz\">2005-09-29T00:00:00Z</h:0x00008105>"
+ "<h:0x0000811C dt:dt=\"boolean\">0</h:0x0000811C>"
+ "<h:0x00008101 dt:dt=\"int\">0</h:0x00008101>"
+ "<h:0x00008102 dt:dt=\"float\">0</h:0x00008102>"
+ "<i:0x00008503 dt:dt=\"boolean\">1</i:0x00008503>";
strHeaderInfo = "<header:to>" + strMailbox + "</header:to>";
strMailInfo = "<mail:subject>Test Task Subject</mail:subject>"
+ "<mail:htmldescription>Test Description</mail:htmldescription>";
// Build the XML body of the PROPPATCH request.
strApptRequest = "<?xml version=\"1.0\"?>"
+ "<g:propertyupdate " + strXMLNSInfo + ">"
+ "<g:set><g:prop>"
+ "<g:contentclass>urn:content-classes:task</g:contentclass>"
+ "<e:outlookmessageclass>IPM.Task</e:outlookmessageclass>"
+ strMailInfo
+ strTaskInfo
+ strHeaderInfo
+ "</g:prop></g:set>"
+ "</g:propertyupdate>";
MyCredentialCache = new System.Net.CredentialCache();
MyCredentialCache.Add( new System.Uri(strTaskUri),
"NTLM",
new System.Net.NetworkCredential(strUserName, strPassword,
strDomain)
);
PROPPATCHRequest =
(System.Net.HttpWebRequest)HttpWebRequest.Create(strTaskUri +
strTaskItem);
PROPPATCHRequest.Credentials = MyCredentialCache;
PROPPATCHRequest.Method = "PROPPATCH";
bytes = Encoding.UTF8.GetBytes((string)strApptRequest);
PROPPATCHRequest.ContentLength = bytes.Length;
PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();
PROPPATCHRequestStream.Write(bytes, 0, bytes.Length);
PROPPATCHRequestStream.Close();
PROPPATCHRequest.ContentType = "text/xml";
PROPPATCHResponse =
(System.Net.HttpWebResponse)PROPPATCHRequest.GetResponse();
PROPPATCHResponse.Close();
Console.WriteLine("Task successfully created.");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Cheers
Glen
"Lorenzo Soncini" <lorenzo.soncini@technoservice.com> wrote in message
news:Or0af01wFHA.3860@TK2MSFTNGP09.phx.gbl...
Hy,
how can I create a task in a public folder using .NET ?
Lorenzo Soncini
|
|
|
| Back to top |
|
 |
|
|
|
|