Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Accessing Public Folders in MS Exchange

    I've created some simple apps using the <cfexchangeconnection> tools and that works great for getting mail, cal, tasks ... etc. from exchange for a specific user.

    Does anyone know how to get calendar items from a "Public Folder" exchange?

    My research has revealed that it is likely going to involve a webdav connection, but I haven't seen many details.

  • #2
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Accessing public folder in Ms Exchange.....

    hello friends.....
    need ur help...
    i m accessing public folder of MS Exchange via OWA
    how to add mails,contacts,tasks,appointment programatically?
    Right now m using HTTP for post items in public folder but there is some problem with URI....

    code snipet of adding contact is as follow............
    please reply as soon as possible....
    thanx in advance....


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Net;
    using System.IO;

    namespace PublicFolderContacts
    {
    class Program
    {
    static void Main(string[] args)
    {
    try
    {
    // TODO: Replace with the URL of an object on the computer that is running Exchange 2000.
    string sUri = "http://localhost/public/vimalcontacts/";

    System.Uri myUri = new System.Uri(sUri);
    HttpWebRequest HttpWRequest = (HttpWebRequest)WebRequest.Create(myUri);

    string strXMLNSInfo;
    string strNameInfo;
    /

    // Specify the Namespaces to be used.
    strXMLNSInfo = "xmlns:g=\"DAV:\"" +
    " xmlns:c=\"urn:schemas:contacts:\"" +
    " xmlns:e=\"http://schemas.microsoft.com/exchange/\"" +
    " xmlns:mapi=\"http://schemas.microsoft.com/mapi/\"" +
    " xmlns:x=\"xml:\" xmlns:cal=\"urn:schemas:calendar:\"" +
    " xmlns:mail=\"urn:schemas:httpmail:\">";

    strNameInfo = "<c:givenName>vimal</c:givenName>" +
    "<c:middlename>kantilal</c:middlename>" +
    "<c:sn>raghwani</c:sn>" +
    "<c:cn>vimal kantilal raghwani</c:cn>" +
    "<mail:subject>vimal raghwani</mail:subject>" +
    "<c:fileas>raghwani, vimal</c:fileas>" +
    "<c:initials>JJD</c:initials>" +
    "<c:nickname>vim</c:nickname>" +
    "<cersonaltitle>Mrs.</cersonaltitle>" +
    "<c:namesuffix>Msc.tech</c:namesuffix>";
    // Specify the Business Address Information.
    // (Street, PO Box, City, State, Postal Code, and Country)


    string sQuery;
    sQuery = "<?xml version='1.0'?>" +
    "<gropertyupdate>" + strXMLNSInfo +
    "<g:set>" +
    "<grop>" +
    "<g:contentclass>urn:content-classeserson</g:contentclass>" +
    "<eutlookmessageclass>IPM.Contact</eutlookmessageclass>" +
    strNameInfo /*+ strBusinessAddrInfo +
    strHomeAddrInfo +strOtherAddrInfo +
    strMailAddrInfo + strPhoneInfo +
    strEmailInfo + strOrganizationalInfo +
    strPersonalInfo + strCustomerInfo +
    strFollowUpInfo + strMiscInfo +
    strUserFieldsInfo */ +
    "</grop>" +
    "</g:set>" +
    "</gropertyupdate>";

    // Set the credentials.

    NetworkCredential myCred = new NetworkCredential("vimal", "Exchange_12345");
    CredentialCache myCredentialCache = new CredentialCache();
    myCredentialCache.Add(myUri, "basic", myCred);
    HttpWRequest.Credentials = myCredentialCache;

    // Set the headers.
    HttpWRequest.KeepAlive = false;
    HttpWRequest.Headers.Set("Pragma", "no-cache");
    HttpWRequest.Headers.Set("Translate", "f");
    HttpWRequest.ContentType = "text/xml";
    HttpWRequest.ContentLength = sQuery.Length;

    //Set the request timeout to 5 minutes.
    HttpWRequest.Timeout = 300000;
    // set the request method
    HttpWRequest.Method = "PROPPATCH";

    // Store the data in a byte array.
    byte[] ByteQuery = System.Text.Encoding.ASCII.GetBytes(sQuery);
    HttpWRequest.ContentLength = ByteQuery.Length;
    Stream QueryStream = HttpWRequest.GetRequestStream();

    // write the data to be posted to the Request Stream
    QueryStream.Write(ByteQuery,0,ByteQuery.Length);
    QueryStream.Close();

    // Send the request and get the response,
    HttpWebResponse HttpWResponse = (HttpWebResponse)HttpWRequest.GetResponse();


    // Get the Status code
    int iStatCode = (int)HttpWResponse.StatusCode;
    string sStatus = iStatCode.ToString();
    Console.WriteLine("Status Code: {0}", sStatus);
    // Get the request headers
    string sReqHeaders = HttpWRequest.Headers.ToString();
    Console.WriteLine(sReqHeaders);

    // Read the Response Steam
    Stream strm = HttpWResponse.GetResponseStream();
    StreamReader sr = new StreamReader(strm);
    string sText = sr.ReadToEnd();
    Console.WriteLine("Response: {0}", sText);

    // Close the stream.
    strm.Close();

    // Clean up
    myCred = null;
    myCredentialCache = null;
    HttpWRequest = null;
    HttpWResponse = null;
    QueryStream = null;
    strm = null;
    sr = null;
    }
    catch (Exception e)
    {
    Console.WriteLine("{0} Exception caught.", e);
    }

    }
    }
    }

  • #3
    Regular Coder
    Join Date
    Feb 2009
    Location
    NJ, USA
    Posts
    476
    Thanks
    2
    Thanked 70 Times in 69 Posts
    This is the ColdFusion forum, you're going to want to post that under the asp.net forum. And wrap your code with code tags when posting.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •