操作exchange类库代码

在C#中通过webdav操作exchange为日历中的约会定义的实体
在C#中通过webdav操作exchange
using System;
在C#中通过webdav操作exchange
using System.Collections;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange
namespace ISoftStone.AccessExchange.WebDav
{

在C#中通过webdav操作exchange    
/// CalendarItemInfo 的摘要说明。
在C#中通过webdav操作exchange    
/// </summary>
在C#中通过webdav操作exchange    public class CalendarItemInfo
{
在C#中通过webdav操作exchange        
private string mName;
在C#中通过webdav操作exchange        
public string Name
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mName;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mName = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
private string mLocation;
在C#中通过webdav操作exchange        
private DateTime mBeginTime ;
在C#中通过webdav操作exchange        
private DateTime mEndTime;
在C#中通过webdav操作exchange        
private int mInstanceType = 0;
在C#中通过webdav操作exchange        
private string mBusyStatus = "BUSY";
在C#中通过webdav操作exchange        
private string mMeetingStatus = "CONFIRMED";
在C#中通过webdav操作exchange        
private bool mIsAllDayEvent = false;
在C#中通过webdav操作exchange        
public bool IsAllDayEvent
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mIsAllDayEvent;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mIsAllDayEvent = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
private bool mResponseRequested = true;
在C#中通过webdav操作exchange        
public bool ResponseRequested
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mResponseRequested;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mResponseRequested = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
private  int mReminderOffset = 900//seconds
在C#中通过webdav操作exchange
        public int ReminderOffset
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mReminderOffset;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mReminderOffset = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
private string  mMailToListMust;
在C#中通过webdav操作exchange        
public string MailToListMust
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mMailToListMust;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mMailToListMust = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
private string mMailToList;
在C#中通过webdav操作exchange        
public string MailToList
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mMailToList;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mMailToList = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
private string mSubject;
在C#中通过webdav操作exchange        
public string Subject
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mSubject;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mSubject = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
private string mHtmlDescription;
在C#中通过webdav操作exchange        
public string HtmlDescription
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mHtmlDescription;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mHtmlDescription = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
private bool mIsFinvited = true;
在C#中通过webdav操作exchange        
public bool IsFinvited
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mIsFinvited;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mIsFinvited = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }


在C#中通过webdav操作exchange        
/// 所在位置
在C#中通过webdav操作exchange        
/// </summary>
在C#中通过webdav操作exchange        public string Location
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mLocation;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mLocation = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }


在C#中通过webdav操作exchange        
/// 约会开始时间
在C#中通过webdav操作exchange        
/// </summary>
在C#中通过webdav操作exchange        public DateTime BeginTime
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return mBeginTime;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                mBeginTime 
= value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }


在C#中通过webdav操作exchange        
/// 约会结束时间
在C#中通过webdav操作exchange        
/// </summary>
在C#中通过webdav操作exchange        public DateTime EndTime
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mEndTime;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mEndTime = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public int InstanceType
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mInstanceType;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mInstanceType = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public string BusyStatus
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mBusyStatus;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mBusyStatus = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public string MeetingStatus
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return this.mMeetingStatus;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                
this.mMeetingStatus = value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
public int GetBoolInt(bool any)
{
在C#中通过webdav操作exchange            
if (any)
{
在C#中通过webdav操作exchange                
return 1;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
return 0;
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
public CalendarItemInfo()
{
在C#中通过webdav操作exchange            
//
在C#中通过webdav操作exchange            
// TODO: 在此处添加构造函数逻辑
在C#中通过webdav操作exchange            
//
在C#中通过webdav操作exchange
        }
在C#中通过webdav操作exchange    }

在C#中通过webdav操作exchange}

在C#中通过webdav操作exchange


User

在C#中通过webdav操作exchangeusing System;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange
namespace ISoftStone.AccessExchange.WebDav
{

在C#中通过webdav操作exchange    
/// User 的摘要说明。
在C#中通过webdav操作exchange    
/// </summary>
在C#中通过webdav操作exchange    public class User
{
在C#中通过webdav操作exchange        
private string m_Name;
在C#中通过webdav操作exchange        
private string m_Password;
在C#中通过webdav操作exchange        
private string m_Domain;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
public string Name
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return m_Name;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                m_Name 
= value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public string Password
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return m_Password;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                m_Password 
= value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
public string Domain
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return m_Domain;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                m_Domain 
= value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
private User(string name,string password,string domain)
{
在C#中通过webdav操作exchange            m_Name 
= name;
在C#中通过webdav操作exchange            m_Password 
= password;
在C#中通过webdav操作exchange            m_Domain 
= domain;
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public static User GetUser(string name,string password,string domain)
{
在C#中通过webdav操作exchange            
return  new User(name,password,domain);
在C#中通过webdav操作exchange            
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public static User GetUser(string name,string password)
{
在C#中通过webdav操作exchange            
return new User(name,password,String.Empty);
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange    }

在C#中通过webdav操作exchange}

在C#中通过webdav操作exchange

session
在C#中通过webdav操作exchangeusing System;
在C#中通过webdav操作exchange
using System.Net;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange
namespace ISoftStone.AccessExchange.WebDav
{

在C#中通过webdav操作exchange    
///This class is for the session management of WebExchange class. 
在C#中通过webdav操作exchange    
/// </summary>
在C#中通过webdav操作exchange    public class WebDavSession
{

在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
private string m_UserMailUrl;
在C#中通过webdav操作exchange        
private ICredentials m_Credentials;
在C#中通过webdav操作exchange        
private WebProxy m_Proxy;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
#endregion

在C#中通过webdav操作exchange

在C#中通过webdav操作exchange        
/// user's mailbox url
在C#中通过webdav操作exchange        
/// </summary>
在C#中通过webdav操作exchange        public string UserMailUrl
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return m_UserMailUrl;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                m_UserMailUrl 
= value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }


在C#中通过webdav操作exchange        
/// web proxy 
在C#中通过webdav操作exchange        
/// </summary>
在C#中通过webdav操作exchange        public WebProxy Proxy
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return m_Proxy;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                m_Proxy 
= value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public ICredentials Credentials 
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
return m_Credentials;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                m_Credentials 
= value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
#endregion
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
public static WebDavSession GetSession(ICredentials obj)
{
在C#中通过webdav操作exchange            WebDavSession session 
=  new WebDavSession();
在C#中通过webdav操作exchange            session.Credentials 
= obj;
在C#中通过webdav操作exchange            
return session;
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public static WebDavSession GetSession(User user)
{
在C#中通过webdav操作exchange            
return GetSession(user,String.Empty);
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public static WebDavSession GetSession(User user,WebProxy proxy)
{
在C#中通过webdav操作exchange            
return GetSession(user,String.Empty,proxy);
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
public static WebDavSession GetSession(User user,string userMailUrl)
{
在C#中通过webdav操作exchange            
return GetSession(user,userMailUrl,null);
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public static WebDavSession GetSession(User user,string userMailUrl,WebProxy proxy)
{
在C#中通过webdav操作exchange            WebDavSession session 
= new WebDavSession();
在C#中通过webdav操作exchange            session.UserMailUrl 
= userMailUrl;
在C#中通过webdav操作exchange            session.Proxy 
= proxy;
在C#中通过webdav操作exchange            
if(user.Domain.Equals(String.Empty))
{
在C#中通过webdav操作exchange                CredentialCache myCredentialCache 
= new CredentialCache();
在C#中通过webdav操作exchange                myCredentialCache.Add( 
new System.Uri(userMailUrl),"NTLM",
在C#中通过webdav操作exchange                    
new NetworkCredential(user.Name,user.Password));
在C#中通过webdav操作exchange                session.Credentials 
= myCredentialCache;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
else
{
在C#中通过webdav操作exchange                CredentialCache myCredentialCache 
= new CredentialCache();
在C#中通过webdav操作exchange                myCredentialCache.Add( 
new System.Uri(userMailUrl),"NTLM",
在C#中通过webdav操作exchange                    
new NetworkCredential(user.Name,user.Password,user.Domain));
在C#中通过webdav操作exchange                session.Credentials 
= myCredentialCache;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
return session;
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public WebDavSession()
{
在C#中通过webdav操作exchange            
//
在C#中通过webdav操作exchange            
// TODO: 在此处添加构造函数逻辑
在C#中通过webdav操作exchange            
//
在C#中通过webdav操作exchange
        }
在C#中通过webdav操作exchange    }

在C#中通过webdav操作exchange}

在C#中通过webdav操作exchange


在C#中通过webdav操作exchangeusing System;
在C#中通过webdav操作exchange
using System.Net;
在C#中通过webdav操作exchange
using System.Text;
在C#中通过webdav操作exchange
using System.Xml;
在C#中通过webdav操作exchange
using System.IO;
在C#中通过webdav操作exchange
using System.Data;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange
namespace ISoftStone.AccessExchange.WebDav
{

在C#中通过webdav操作exchange    
/// WebExchange 的摘要说明。
在C#中通过webdav操作exchange    
/// </summary>
在C#中通过webdav操作exchange    public class WebExchange
{
在C#中通过webdav操作exchange        
private WebDavSession m_Session;
在C#中通过webdav操作exchange        
private string m_Url;
在C#中通过webdav操作exchange        
private Encoding m_Encode;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
private HttpWebRequest objRequest;
在C#中通过webdav操作exchange        
private WebResponse objResponse;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
在C#中通过webdav操作exchange        
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        
public WebDavSession Session
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
if(m_Session == null)
{
在C#中通过webdav操作exchange                    m_Session 
= new WebDavSession();
在C#中通过webdav操作exchange                }

在C#中通过webdav操作exchange                
return m_Session;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                m_Session 
= value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public string Url
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
if(m_Url != null)
{
在C#中通过webdav操作exchange                    
if(m_Url.LastIndexOf("/"== m_Url.Length -1)
{
在C#中通过webdav操作exchange                        
return m_Url.Substring(0,m_Url.Length-1);
在C#中通过webdav操作exchange                    }

在C#中通过webdav操作exchange                }

在C#中通过webdav操作exchange                
return m_Url;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                m_Url 
= value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public Encoding Encode
{
在C#中通过webdav操作exchange            
get
{
在C#中通过webdav操作exchange                
if (m_Encode == null)
{
在C#中通过webdav操作exchange                    m_Encode 
= new UTF8Encoding();
在C#中通过webdav操作exchange                }

在C#中通过webdav操作exchange                
return m_Encode;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
set
{
在C#中通过webdav操作exchange                m_Encode 
= value;
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
在C#中通过webdav操作exchange        
public WebExchange(WebDavSession webDavSession)
{
在C#中通过webdav操作exchange            m_Session 
= webDavSession;
在C#中通过webdav操作exchange            m_Url 
= webDavSession.UserMailUrl;
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public WebExchange(WebDavSession webDavSession,string url)
{
在C#中通过webdav操作exchange            m_Session 
= webDavSession;
在C#中通过webdav操作exchange            m_Url 
= url;
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public WebExchange(string url)
{
在C#中通过webdav操作exchange            m_Url 
= url;
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public void CreateCalendarItem(CalendarItemInfo itemInfo)
{
在C#中通过webdav操作exchange            
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange            
byte[] bytes = null;
在C#中通过webdav操作exchange            Stream requestStream 
= null;
在C#中通过webdav操作exchange            Stream responseStream 
= null;
在C#中通过webdav操作exchange            
string strMailbox = "jianli";
在C#中通过webdav操作exchange            
string strXMLNSInfo =null;
在C#中通过webdav操作exchange            
try
{
在C#中通过webdav操作exchange                objRequest 
= (System.Net.HttpWebRequest)HttpWebRequest.Create(this.Url + "/" + itemInfo.Name);
在C#中通过webdav操作exchange                
//objRequest = (HttpWebRequest)HttpWebRequest.Create(this.Url + "/" + "testdee");
在C#中通过webdav操作exchange                
// Add the network credentials to the request.
在C#中通过webdav操作exchange
                objRequest.Credentials = Session.Credentials;
在C#中通过webdav操作exchange                
// Specify the DELETE method.
在C#中通过webdav操作exchange
                objRequest.Method = "PROPPATCH";
在C#中通过webdav操作exchange                
// XML namespace info for the WebDAV request.
在C#中通过webdav操作exchange
                strXMLNSInfo = "xmlns:g=\"DAV:\" "
在C#中通过webdav操作exchange                    
+ "xmlns:e=\"http://schemas.microsoft.com/exchange/\" "
在C#中通过webdav操作exchange
                    + "xmlns:mapi=\"http://schemas.microsoft.com/mapi/\" "
在C#中通过webdav操作exchange
                    + "xmlns:mapit=\"http://schemas.microsoft.com/mapi/proptag/\" "
在C#中通过webdav操作exchange
                    + "xmlns:x=\"xml:\" xmlns:cal=\"urn:schemas:calendar:\" "
在C#中通过webdav操作exchange                    
+ "xmlns:dt=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" "
在C#中通过webdav操作exchange                    
+ "xmlns:header=\"urn:schemas:mailheader:\" "
在C#中通过webdav操作exchange                    
+ "xmlns:mail=\"urn:schemas:httpmail:\"";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Set the appointment item properties.  To create an all-day meeting,
在C#中通过webdav操作exchange                
// set the dtstart/dtend range for 24 hours or more and set the alldayevent property
在C#中通过webdav操作exchange                
// to 1.  See the documentation on the properties
在C#中通过webdav操作exchange                
// in the urn:schemas:calendar: namespace for more information.
在C#中通过webdav操作exchange
                string strCalInfo = "<cal:location>" + itemInfo.Location + "</cal:location>"
在C#中通过webdav操作exchange                    
+ "<cal:dtstart dt:dt=\"dateTime.tz\">2005-04-24T08:00:00.000Z</cal:dtstart>"
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                    
+ "<cal:dtend dt:dt=\"dateTime.tz\">2005-04-24T08:40:00.000Z</cal:dtend>"
在C#中通过webdav操作exchange
//                    + "<cal:dtstart dt:dt=\"dateTime.tz\">" + itemInfo.BeginTime.ToShortDateString() + "T" + itemInfo.BeginTime.ToLongTimeString() + ".000Z" + "</cal:dtstart>"
在C#中通过webdav操作exchange
//                    + "<cal:dtend dt:dt=\"dateTime.tz\">"  + itemInfo.EndTime.ToShortDateString() + "T" + itemInfo.EndTime.ToLongTimeString() + ".000Z" +  "</cal:dtend>"
在C#中通过webdav操作exchange
                    + "<cal:instancetype dt:dt=\"int\">" + itemInfo.InstanceType.ToString() + "</cal:instancetype>"
在C#中通过webdav操作exchange                    
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                    
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                    
+ "<cal:busystatus>" + itemInfo.BusyStatus + "</cal:busystatus>"
在C#中通过webdav操作exchange                    
+ "<cal:meetingstatus> " + itemInfo.MeetingStatus.ToString() + "</cal:meetingstatus>"
在C#中通过webdav操作exchange                    
+ "<cal:alldayevent dt:dt=\"boolean\">" + itemInfo.GetBoolInt(itemInfo.IsAllDayEvent).ToString() + "</cal:alldayevent>"
在C#中通过webdav操作exchange                    
+ "<cal:responserequested dt:dt=\"boolean\">" + itemInfo.GetBoolInt(itemInfo.IsAllDayEvent).ToString() + "</cal:responserequested>"
在C#中通过webdav操作exchange                    
// Set the reminder time (in seconds).
在C#中通过webdav操作exchange
                    + "<cal:reminderoffset dt:dt=\"int\">" + itemInfo.ReminderOffset.ToString() +"</cal:reminderoffset>";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange
//                string strCalInfo = "<cal:location>meetappt Location</cal:location>"
在C#中通过webdav操作exchange
//                    + "<cal:dtstart dt:dt=\"dateTime.tz\">2004-05-18T23:00:00.000Z</cal:dtstart>"
在C#中通过webdav操作exchange
//                    + "<cal:dtend dt:dt=\"dateTime.tz\">2004-05-18T23:30:00.000Z</cal:dtend>"
在C#中通过webdav操作exchange
//                    + "<cal:instancetype dt:dt=\"int\">0</cal:instancetype>"
在C#中通过webdav操作exchange
//                    + "<cal:busystatus>BUSY</cal:busystatus>"
在C#中通过webdav操作exchange
//                    + "<cal:meetingstatus>CONFIRMED</cal:meetingstatus>"
在C#中通过webdav操作exchange
//                    + "<cal:alldayevent dt:dt=\"boolean\">0</cal:alldayevent>"
在C#中通过webdav操作exchange
//                    + "<cal:responserequested dt:dt=\"boolean\">1</cal:responserequested>"
在C#中通过webdav操作exchange
//
在C#中通过webdav操作exchange
//                    // Set the reminder time (in seconds).
在C#中通过webdav操作exchange
//                    + "<cal:reminderoffset dt:dt=\"int\">900</cal:reminderoffset>";
在C#中通过webdav操作exchange
//
在C#中通过webdav操作exchange
//
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Set the required attendee of the appointment.
在C#中通过webdav操作exchange
                string strHeaderInfo = "<header:to>" + itemInfo.MailToListMust + "</header:to>";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Set the subject of the appointment.
在C#中通过webdav操作exchange
                string strMailInfo = "<mail:subject>" + itemInfo.Subject + "</mail:subject>"
在C#中通过webdav操作exchange                    
+ "<mail:htmldescription>" + itemInfo.HtmlDescription + "</mail:htmldescription>";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Build the XML body of the PROPPATCH request.
在C#中通过webdav操作exchange
                string strApptRequest = "<?xml version=\"1.0\"?>"
在C#中通过webdav操作exchange                    
+ "<g:propertyupdate " + strXMLNSInfo + ">"
在C#中通过webdav操作exchange                    
+ "<g:set><g:prop>"
在C#中通过webdav操作exchange                    
+ "<g:contentclass>urn:content-classes:appointment</g:contentclass>"
在C#中通过webdav操作exchange                    
+ "<e:outlookmessageclass>IPM.Appointment</e:outlookmessageclass>"
在C#中通过webdav操作exchange                    
+ strMailInfo
在C#中通过webdav操作exchange                    
+ strCalInfo
在C#中通过webdav操作exchange                    
+ strHeaderInfo
在C#中通过webdav操作exchange                    
+ "<mapi:finvited dt:dt=\"boolean\">1</mapi:finvited>"
在C#中通过webdav操作exchange                    
+ "</g:prop></g:set>"
在C#中通过webdav操作exchange                    
+ "</g:propertyupdate>";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                bytes 
= this.Encode.GetBytes((string)strApptRequest);
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
// Set the content header length.  This must be
在C#中通过webdav操作exchange                
// done before writing data to the request stream.
在C#中通过webdav操作exchange
                objRequest.ContentLength = bytes.Length;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Get a reference to the request stream.
在C#中通过webdav操作exchange
                requestStream = objRequest.GetRequestStream();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
// Write the request body to the request stream.
在C#中通过webdav操作exchange
                requestStream.Write(bytes, 0, bytes.Length);
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Close the Stream object to release the connection
在C#中通过webdav操作exchange                
// for further use.
在C#中通过webdav操作exchange
                requestStream.Close();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Set the content type header.
在C#中通过webdav操作exchange
                objRequest.ContentType = "text/xml";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Send the PROPFIND method request and get the
在C#中通过webdav操作exchange                
// response from the server.
在C#中通过webdav操作exchange
                objResponse = (HttpWebResponse)objRequest.GetResponse();
在C#中通过webdav操作exchange                
//return null;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Get the XML response stream.
在C#中通过webdav操作exchange
                responseStream = objResponse.GetResponseStream();
在C#中通过webdav操作exchange                
// Close the HttpWebResponse object.
在C#中通过webdav操作exchange
                objResponse.Close();
在C#中通过webdav操作exchange                responseStream.Close();
在C#中通过webdav操作exchange                
//Console.WriteLine("Item successfully deleted.")
在C#中通过webdav操作exchange
            }
在C#中通过webdav操作exchange            
catch(Exception ex)
{
在C#中通过webdav操作exchange                
// Catch any exceptions. Any error codes from the PROPPATCH
在C#中通过webdav操作exchange                
// method request on the server will be caught
在C#中通过webdav操作exchange                
// here, also.
在C#中通过webdav操作exchange
                throw new Exception("can't create item " + ex.ToString());
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public void CreateCalendarItem(string itemName)
{
在C#中通过webdav操作exchange            
byte[] bytes = null;
在C#中通过webdav操作exchange            Stream requestStream 
= null;
在C#中通过webdav操作exchange            Stream responseStream 
= null;
在C#中通过webdav操作exchange            
string strMailbox = "jianli";
在C#中通过webdav操作exchange            
try
{
在C#中通过webdav操作exchange                objRequest 
= (System.Net.HttpWebRequest)HttpWebRequest.Create(this.Url + "/" + itemName);
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Add the network credentials to the request.
在C#中通过webdav操作exchange
                objRequest.Credentials = this.Session.Credentials;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Specify the DELETE method.
在C#中通过webdav操作exchange
                objRequest.Method = "PROPPATCH";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// XML namespace info for the WebDAV request.
在C#中通过webdav操作exchange
                string strXMLNSInfo = "xmlns:g=\"DAV:\" "
在C#中通过webdav操作exchange                    
+ "xmlns:e=\"http://schemas.microsoft.com/exchange/\" "
在C#中通过webdav操作exchange
                    + "xmlns:mapi=\"http://schemas.microsoft.com/mapi/\" "
在C#中通过webdav操作exchange
                    + "xmlns:mapit=\"http://schemas.microsoft.com/mapi/proptag/\" "
在C#中通过webdav操作exchange
                    + "xmlns:x=\"xml:\" xmlns:cal=\"urn:schemas:calendar:\" "
在C#中通过webdav操作exchange                    
+ "xmlns:dt=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" "
在C#中通过webdav操作exchange                    
+ "xmlns:header=\"urn:schemas:mailheader:\" "
在C#中通过webdav操作exchange                    
+ "xmlns:mail=\"urn:schemas:httpmail:\"";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Set the appointment item properties.  To create an all-day meeting,
在C#中通过webdav操作exchange                
// set the dtstart/dtend range for 24 hours or more and set the alldayevent property
在C#中通过webdav操作exchange                
// to 1.  See the documentation on the properties
在C#中通过webdav操作exchange                
// in the urn:schemas:calendar: namespace for more information.
在C#中通过webdav操作exchange
                string strCalInfo = "<cal:location>meetappt Location</cal:location>"
在C#中通过webdav操作exchange                    
+ "<cal:dtstart dt:dt=\"dateTime.tz\">2004-05-18T23:00:00.000Z</cal:dtstart>"
在C#中通过webdav操作exchange                    
+ "<cal:dtend dt:dt=\"dateTime.tz\">2004-05-18T23:30:00.000Z</cal:dtend>"
在C#中通过webdav操作exchange                    
+ "<cal:instancetype dt:dt=\"int\">0</cal:instancetype>"
在C#中通过webdav操作exchange                    
+ "<cal:busystatus>BUSY</cal:busystatus>"
在C#中通过webdav操作exchange                    
+ "<cal:meetingstatus>CONFIRMED</cal:meetingstatus>"
在C#中通过webdav操作exchange                    
+ "<cal:alldayevent dt:dt=\"boolean\">0</cal:alldayevent>"
在C#中通过webdav操作exchange                    
+ "<cal:responserequested dt:dt=\"boolean\">1</cal:responserequested>"
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                    
// Set the reminder time (in seconds).
在C#中通过webdav操作exchange
                    + "<cal:reminderoffset dt:dt=\"int\">900</cal:reminderoffset>";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Set the required attendee of the appointment.
在C#中通过webdav操作exchange
                string strHeaderInfo = "<header:to>" + strMailbox + ";章清平 &lt;qpzhang@iisdnet.com &gt;></header:to>";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Set the subject of the appointment.
在C#中通过webdav操作exchange
                string strMailInfo = "<mail:subject>Test Appointment Subject</mail:subject>"
在C#中通过webdav操作exchange                    
+ "<mail:htmldescription>Let's meet here</mail:htmldescription>";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Build the XML body of the PROPPATCH request.
在C#中通过webdav操作exchange
                string strApptRequest = "<?xml version=\"1.0\"?>"
在C#中通过webdav操作exchange                    
+ "<g:propertyupdate " + strXMLNSInfo + ">"
在C#中通过webdav操作exchange                    
+ "<g:set><g:prop>"
在C#中通过webdav操作exchange                    
+ "<g:contentclass>urn:content-classes:appointment</g:contentclass>"
在C#中通过webdav操作exchange                    
+ "<e:outlookmessageclass>IPM.Appointment</e:outlookmessageclass>"
在C#中通过webdav操作exchange                    
+ strMailInfo
在C#中通过webdav操作exchange                    
+ strCalInfo
在C#中通过webdav操作exchange                    
+ strHeaderInfo
在C#中通过webdav操作exchange                    
+ "<mapi:finvited dt:dt=\"boolean\">1</mapi:finvited>"
在C#中通过webdav操作exchange                    
+ "</g:prop></g:set>"
在C#中通过webdav操作exchange                    
+ "</g:propertyupdate>";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                bytes 
= this.Encode.GetBytes((string)strApptRequest);
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
// Set the content header length.  This must be
在C#中通过webdav操作exchange                
// done before writing data to the request stream.
在C#中通过webdav操作exchange
                objRequest.ContentLength = bytes.Length;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Get a reference to the request stream.
在C#中通过webdav操作exchange
                requestStream = objRequest.GetRequestStream();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
// Write the request body to the request stream.
在C#中通过webdav操作exchange
                requestStream.Write(bytes, 0, bytes.Length);
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Close the Stream object to release the connection
在C#中通过webdav操作exchange                
// for further use.
在C#中通过webdav操作exchange
                requestStream.Close();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Set the content type header.
在C#中通过webdav操作exchange
                objRequest.ContentType = "text/xml";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
// Send the PROPFIND method request and get the
在C#中通过webdav操作exchange                
// response from the server.
在C#中通过webdav操作exchange
                objResponse = (HttpWebResponse)objRequest.GetResponse();
在C#中通过webdav操作exchange                
//return null;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Get the XML response stream.
在C#中通过webdav操作exchange
                responseStream = objResponse.GetResponseStream();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Close the HttpWebResponse object.
在C#中通过webdav操作exchange
                objResponse.Close();
在C#中通过webdav操作exchange                responseStream.Close();
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
//Console.WriteLine("Item successfully deleted.")
在C#中通过webdav操作exchange

在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
catch(Exception ex)
{
在C#中通过webdav操作exchange                
// Catch any exceptions. Any error codes from the PROPPATCH
在C#中通过webdav操作exchange                
// method request on the server will be caught
在C#中通过webdav操作exchange                
// here, also.
在C#中通过webdav操作exchange
                throw new Exception("can't create item " + ex.ToString());
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public void GetInfo()
{
在C#中通过webdav操作exchange
//            string strXml;
在C#中通过webdav操作exchange
//            strXml = "<?xml version='"+"1.0"+"'?>";
在C#中通过webdav操作exchange
//            strXml = strXml + "<a:propfind xmlns:a='"+"DAV:"+"'  xmlns:e='"+"urn:schemas:httpmail:'"+">";
在C#中通过webdav操作exchange
//            strXml = strXml + "<a:prop>";
在C#中通过webdav操作exchange
//            //日历
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:calendar/>";
在C#中通过webdav操作exchange
//            
在C#中通过webdav操作exchange
//            //联系人
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:contacts/>";
在C#中通过webdav操作exchange
//            
在C#中通过webdav操作exchange
//            //回收站
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:deleteditems/>";
在C#中通过webdav操作exchange
//            
在C#中通过webdav操作exchange
//            //草稿
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:drafts/>";
在C#中通过webdav操作exchange
//            
在C#中通过webdav操作exchange
//            //收件箱
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:inbox/>";
在C#中通过webdav操作exchange
//            
在C#中通过webdav操作exchange
//            //日记
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:journal/>";
在C#中通过webdav操作exchange
//            
在C#中通过webdav操作exchange
//            //便笺
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:notes/>";
在C#中通过webdav操作exchange
//            
在C#中通过webdav操作exchange
//            //发件箱
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:outbox/>";
在C#中通过webdav操作exchange
//            
在C#中通过webdav操作exchange
//            //已发邮件
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:sentitems/>";
在C#中通过webdav操作exchange
//            
在C#中通过webdav操作exchange
//            //任务
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:tasks/>";
在C#中通过webdav操作exchange
//            
在C#中通过webdav操作exchange
//            //短信
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:sendmsg/>";
在C#中通过webdav操作exchange
//            strXml = strXml + "<e:msgfolderroot/>";
在C#中通过webdav操作exchange
//            strXml = strXml + "</a:prop>";
在C#中通过webdav操作exchange
//            strXml = strXml + "</a:propfind>";
在C#中通过webdav操作exchange
//
在C#中通过webdav操作exchange
//            //声明XMLHTTP对象
在C#中通过webdav操作exchange
//            MSXML2.XMLHTTP30Class objXmlHttp=new MSXML2.XMLHTTP30Class();
在C#中通过webdav操作exchange
//            //声明DOMDocument对象
在C#中通过webdav操作exchange
//            MSXML2.DOMDocument30Class  objXmlDOMDocument=new MSXML2.DOMDocument30Class();
在C#中通过webdav操作exchange
//            objXmlHttp.open("PROPFIND",strUserFolder,false,strDomainName+"\\"+strUserName,strUserPwd);
在C#中通过webdav操作exchange
//            objXmlHttp.setRequestHeader("content-type","text/xml");
在C#中通过webdav操作exchange
//            objXmlHttp.setRequestHeader("depth","0");
在C#中通过webdav操作exchange
//            objXmlHttp.send(strXml);
在C#中通过webdav操作exchange
//    
在C#中通过webdav操作exchange
//            if (objXmlHttp.status.ToString()=="207") //DAV读取正确
在C#中通过webdav操作exchange
//            {
在C#中通过webdav操作exchange
//                objXmlDOMDocument.load(objXmlHttp.responseXML);
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                //日历
在C#中通过webdav操作exchange
//                strCalendar=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:calendar").text;
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                //联系人
在C#中通过webdav操作exchange
//                strContacts=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:contacts").text;
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                //垃圾箱
在C#中通过webdav操作exchange
//                strDeleteditems=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:deleteditems").text;
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                //草稿
在C#中通过webdav操作exchange
//                strDrafts=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:drafts").text;
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                //收件箱
在C#中通过webdav操作exchange
//                strInbox=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:inbox").text;
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                //日记
在C#中通过webdav操作exchange
//                strJournal=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:journal").text;
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                //便笺
在C#中通过webdav操作exchange
//                strNotes=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:notes").text;
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                //发件箱
在C#中通过webdav操作exchange
//                strOutbox=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:outbox").text;
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                //已发邮件
在C#中通过webdav操作exchange
//                strSentitems=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:sentitems").text;
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                //任务
在C#中通过webdav操作exchange
//                strTasks=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:tasks").text;
在C#中通过webdav操作exchange
//                        
在C#中通过webdav操作exchange
//                //短信
在C#中通过webdav操作exchange
//                strSendmsg=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:sendmsg").text;
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                strMsgfolderroot=objXmlDOMDocument.selectSingleNode("//a:multistatus/a:response/a:propstat/a:prop/d:msgfolderroot").text;
在C#中通过webdav操作exchange
//                
在C#中通过webdav操作exchange
//                //Label1.Text=strCalendar+strDeleteditems;//debug
在C#中通过webdav操作exchange
//            }
在C#中通过webdav操作exchange
//            else //DAV读取错误
在C#中通过webdav操作exchange
//            {
在C#中通过webdav操作exchange
//                Response.Write("<?xml version='1.0' encoding='GB2312'?>");
在C#中通过webdav操作exchange
//                Response.Write("<Error>");
在C#中通过webdav操作exchange
//                Response.Write("<Status>" + objXmlHttp.status + "</Status>");
在C#中通过webdav操作exchange
//                Response.Write("<Statustext>" + objXmlHttp.statusText.ToString() + "</Statustext>");
在C#中通过webdav操作exchange
//                Response.Write("</Error>");
在C#中通过webdav操作exchange
//            }
在C#中通过webdav操作exchange
//        
在C#中通过webdav操作exchange

在C#中通过webdav操作exchange
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public XmlDocument SearchItems(string xmlSearchBody)
{
在C#中通过webdav操作exchange            
//string strSrcURI = ItemURL;
在C#中通过webdav操作exchange

在C#中通过webdav操作exchange            
byte[] bytes = null;
在C#中通过webdav操作exchange            Stream requestStream 
= null;
在C#中通过webdav操作exchange            Stream responseStream 
= null;
在C#中通过webdav操作exchange            XmlDocument responseXmlDoc 
= null;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange            
try
{
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
// Create the HttpWebRequest object.
在C#中通过webdav操作exchange
                objRequest = (HttpWebRequest)HttpWebRequest.Create(Url);
在C#中通过webdav操作exchange                
// Add the network credentials to the request.
在C#中通过webdav操作exchange
                objRequest.Credentials = m_Session.Credentials;
在C#中通过webdav操作exchange                
// Specify the method.
在C#中通过webdav操作exchange                
//objRequest.Method = "PROPFIND";
在C#中通过webdav操作exchange
                objRequest.Method = "SEARCH";
在C#中通过webdav操作exchange                
// Encode the body 
在C#中通过webdav操作exchange
                bytes = this.Encode.GetBytes((string)xmlSearchBody);
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
// Set the content header length.  This must be
在C#中通过webdav操作exchange                
// done before writing data to the request stream.
在C#中通过webdav操作exchange
                objRequest.ContentLength = bytes.Length;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Get a reference to the request stream.
在C#中通过webdav操作exchange
                requestStream = objRequest.GetRequestStream();
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Write the request body to the request stream.
在C#中通过webdav操作exchange
                requestStream.Write(bytes, 0, bytes.Length);
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Close the Stream object to release the connection
在C#中通过webdav操作exchange                
// for further use.
在C#中通过webdav操作exchange
                requestStream.Close();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Set the content type header.
在C#中通过webdav操作exchange
                objRequest.ContentType = "text/xml";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Send the PROPFIND method request and get the
在C#中通过webdav操作exchange                
// response from the server.
在C#中通过webdav操作exchange
                objResponse = (HttpWebResponse)objRequest.GetResponse();
在C#中通过webdav操作exchange                
//return null;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Get the XML response stream.
在C#中通过webdav操作exchange
                responseStream = objResponse.GetResponseStream();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Create the XmlDocument object from the XML response stream.
在C#中通过webdav操作exchange
                responseXmlDoc = new XmlDocument();
在C#中通过webdav操作exchange                responseXmlDoc.Load(responseStream);
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
// Clean up.
在C#中通过webdav操作exchange
                responseStream.Close();
在C#中通过webdav操作exchange                objResponse.Close();
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
//responseXmlDoc.Save(@"C:\jjj.xml");
在C#中通过webdav操作exchange
                return responseXmlDoc;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
catch(Exception e)
{
在C#中通过webdav操作exchange                
throw new Exception("Can't get the data" + e.ToString());
在C#中通过webdav操作exchange            }
    
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange        
public XmlDocument GetItemFieldValue(string strBody)
{
在C#中通过webdav操作exchange            
//string strSrcURI = ItemURL;
在C#中通过webdav操作exchange

在C#中通过webdav操作exchange            
byte[] bytes = null;
在C#中通过webdav操作exchange            Stream requestStream 
= null;
在C#中通过webdav操作exchange            Stream responseStream 
= null;
在C#中通过webdav操作exchange            XmlDocument responseXmlDoc 
= null;
在C#中通过webdav操作exchange            
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange            
try
{
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
// Create the HttpWebRequest object.
在C#中通过webdav操作exchange
                objRequest = (HttpWebRequest)HttpWebRequest.Create(Url);
在C#中通过webdav操作exchange                
// Add the network credentials to the request.
在C#中通过webdav操作exchange
                objRequest.Credentials = m_Session.Credentials;
在C#中通过webdav操作exchange                
// Specify the method.
在C#中通过webdav操作exchange
                objRequest.Method = "PROPFIND";
在C#中通过webdav操作exchange                
//objRequest.Method = "SEARCH";
在C#中通过webdav操作exchange                
// Encode the body 
在C#中通过webdav操作exchange
                bytes = this.Encode.GetBytes((string)strBody);
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
// Set the content header length.  This must be
在C#中通过webdav操作exchange                
// done before writing data to the request stream.
在C#中通过webdav操作exchange
                objRequest.ContentLength = bytes.Length;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Get a reference to the request stream.
在C#中通过webdav操作exchange
                requestStream = objRequest.GetRequestStream();
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Write the request body to the request stream.
在C#中通过webdav操作exchange
                requestStream.Write(bytes, 0, bytes.Length);
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Close the Stream object to release the connection
在C#中通过webdav操作exchange                
// for further use.
在C#中通过webdav操作exchange
                requestStream.Close();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Set the content type header.
在C#中通过webdav操作exchange
                objRequest.ContentType = "text/xml";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Send the PROPFIND method request and get the
在C#中通过webdav操作exchange                
// response from the server.
在C#中通过webdav操作exchange
                objResponse = (HttpWebResponse)objRequest.GetResponse();
在C#中通过webdav操作exchange                
//return null;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Get the XML response stream.
在C#中通过webdav操作exchange
                responseStream = objResponse.GetResponseStream();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Create the XmlDocument object from the XML response stream.
在C#中通过webdav操作exchange
                responseXmlDoc = new XmlDocument();
在C#中通过webdav操作exchange                responseXmlDoc.Load(responseStream);
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
// Clean up.
在C#中通过webdav操作exchange
                responseStream.Close();
在C#中通过webdav操作exchange                objResponse.Close();
在C#中通过webdav操作exchange                responseXmlDoc.Save(
@"C:\jjj.xml");
在C#中通过webdav操作exchange                
return responseXmlDoc;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
catch(Exception e)
{
在C#中通过webdav操作exchange                
throw new Exception("Can't get the data" + e.ToString());
在C#中通过webdav操作exchange            }
            
在C#中通过webdav操作exchange        }


在C#中通过webdav操作exchange        
/// 删除一个item
在C#中通过webdav操作exchange        
/// </summary>
在C#中通过webdav操作exchange        
/// <param name="itemUrl"></param>
在C#中通过webdav操作exchange        public void DeleteItem(string itemUrl)
{
在C#中通过webdav操作exchange            
try
{
在C#中通过webdav操作exchange                objRequest 
= (System.Net.HttpWebRequest)HttpWebRequest.Create(itemUrl);
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Add the network credentials to the request.
在C#中通过webdav操作exchange
                objRequest.Credentials = this.Session.Credentials;
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Specify the DELETE method.
在C#中通过webdav操作exchange
                objRequest.Method = "DELETE";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Send the DELETE method request.
在C#中通过webdav操作exchange
                objResponse = (System.Net.HttpWebResponse)objRequest.GetResponse();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Close the HttpWebResponse object.
在C#中通过webdav操作exchange
                objResponse.Close();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
//Console.WriteLine("Item successfully deleted.")
在C#中通过webdav操作exchange

在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
catch(Exception e)
{
在C#中通过webdav操作exchange                
throw new Exception("Can't delete the item" + e.ToString());
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange        }


在C#中通过webdav操作exchange        
/// create a subfolder
在C#中通过webdav操作exchange        
/// </summary>
在C#中通过webdav操作exchange        
/// <param name="strBody"></param>
在C#中通过webdav操作exchange        public void CreateFolder(string folderName)
{
在C#中通过webdav操作exchange            
//string strSrcURI = ItemURL;
在C#中通过webdav操作exchange
            try
{
在C#中通过webdav操作exchange                
// Create the HttpWebRequest object.
在C#中通过webdav操作exchange
                objRequest = (HttpWebRequest)HttpWebRequest.Create(Url + "/" + folderName);
在C#中通过webdav操作exchange                
// Add the network credentials to the request.
在C#中通过webdav操作exchange
                objRequest.Credentials = m_Session.Credentials;
在C#中通过webdav操作exchange                
// Specify the method.
在C#中通过webdav操作exchange
                objRequest.Method = "MKCOL";
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                objResponse 
= (System.Net.HttpWebResponse)objRequest.GetResponse();
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
// Close the HttpWebResponse object.
在C#中通过webdav操作exchange
                objResponse.Close();
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange            }

在C#中通过webdav操作exchange            
catch(Exception e)
{
在C#中通过webdav操作exchange                
throw new Exception("Can't create the foder" + e.ToString());
在C#中通过webdav操作exchange            }
            
在C#中通过webdav操作exchange        }

在C#中通过webdav操作exchange
//        public DataSet GetDataFromXmlDocument(XmlDocument xml)
在C#中通过webdav操作exchange
//        {
在C#中通过webdav操作exchange
//            XmlDocument xd = new XmlDocument();
在C#中通过webdav操作exchange
//            xd.LoadXml("<myroot>" + FieldStr + "</myroot>");
在C#中通过webdav操作exchange
//            XPathNavigator xpn = xd.CreateNavigator();
在C#中通过webdav操作exchange
//            XPathNodeIterator ni = xpn.Select("/myroot/Field");
在C#中通过webdav操作exchange
//            while (ni.MoveNext())
在C#中通过webdav操作exchange
//            {
在C#中通过webdav操作exchange
//                SpsExpendFieldData objFieldData = SpsExpendFieldData.Create(ni.Current.GetAttribute("Name",""),
在C#中通过webdav操作exchange
//                    ni.Current.GetAttribute("ColName",""),
在C#中通过webdav操作exchange
//                    0,
在C#中通过webdav操作exchange
//                    ni.Current.GetAttribute("Type",""));
在C#中通过webdav操作exchange
//                result.Add(objFieldData);
在C#中通过webdav操作exchange
//            }
在C#中通过webdav操作exchange
//            return result;
在C#中通过webdav操作exchange
//        }
在C#中通过webdav操作exchange
    }
在C#中通过webdav操作exchange}

在C#中通过webdav操作exchange


在C#中通过webdav操作exchangeWebExchange obj = new WebExchange(WebDavSession.GetSession(ISoftStone.AccessExchange.WebDav.User.GetUser("jianli","password","iisdnet"),
在C#中通过webdav操作exchange                
"http://10.10.10.10/exchange/jianli/日历"));
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange            System.Text.StringBuilder sb 
= new System.Text.StringBuilder();
在C#中通过webdav操作exchange            sb.Append(
" <?xml version=\"1.0\"?>");
在C#中通过webdav操作exchange            sb.Append(
" <D:searchrequest xmlns:D = \"DAV:\" >");
在C#中通过webdav操作exchange            sb.Append(
" <D:sql>");
在C#中通过webdav操作exchange            sb.Append(
" SELECT \"DAV:displayname\"");
在C#中通过webdav操作exchange            sb.Append(
" ,\"DAV:href\" ");
在C#中通过webdav操作exchange            sb.Append(
",\"urn:schemas:calendar:dtstart\" ");
在C#中通过webdav操作exchange            sb.Append(
",\"urn:schemas:calendar:dtend\" ");
在C#中通过webdav操作exchange            sb.Append(
" ,\"urn:schemas:calendar:location\"");
在C#中通过webdav操作exchange            sb.Append(
",\"urn:schemas:calendar:busystatus\" ");
在C#中通过webdav操作exchange            sb.Append(
",\"urn:schemas:httpmail:subject\"");
在C#中通过webdav操作exchange            sb.Append(
" ,\"urn:schemas:httpmail:htmldescription\"" );
在C#中通过webdav操作exchange            sb.Append(
" FROM  \"http://10.10.10.10/exchange/jianli/日历\"");
在C#中通过webdav操作exchange
            sb.Append(" WHERE \"urn:schemas:calendar:dtstart\" >= '" + this.TBBeginTime.Text.Trim() + "");
在C#中通过webdav操作exchange            sb.Append(
" AND \"urn:schemas:calendar:dtstart\" &lt; '2006-01-01' ");
在C#中通过webdav操作exchange            sb.Append(
" </D:sql></D:searchrequest> ");


在C#中通过webdav操作exchangeDataSet ds = new DataSet();
在C#中通过webdav操作exchange            DataTable db 
= new DataTable();
在C#中通过webdav操作exchange            ds.Tables.Add(db);
在C#中通过webdav操作exchange            
在C#中通过webdav操作exchange            ds.Tables[
0].Columns.Add("displayname",System.Type.GetType("System.String"));
在C#中通过webdav操作exchange            ds.Tables[
0].Columns.Add("href",System.Type.GetType("System.String"));
在C#中通过webdav操作exchange            ds.Tables[
0].Columns.Add("dtstart",System.Type.GetType("System.DateTime"));
在C#中通过webdav操作exchange            ds.Tables[
0].Columns.Add("dtend",System.Type.GetType("System.DateTime"));
在C#中通过webdav操作exchange            ds.Tables[
0].Columns.Add("location",System.Type.GetType("System.String"));
在C#中通过webdav操作exchange            ds.Tables[
0].Columns.Add("busystatus",System.Type.GetType("System.String"));
在C#中通过webdav操作exchange            ds.Tables[
0].Columns.Add("subject",System.Type.GetType("System.String"));
在C#中通过webdav操作exchange            ds.Tables[
0].Columns.Add("htmldescription",System.Type.GetType("System.String"));
在C#中通过webdav操作exchange            
//ds.Tables[0].Columns.Add("href",System.Type.GetType("System.String"));
在C#中通过webdav操作exchange

在C#中通过webdav操作exchange            XmlDocument xd;
在C#中通过webdav操作exchange            
//xd.Load(@"C:\jjj.xml");
在C#中通过webdav操作exchange
            xd = obj.SearchItems(sb.ToString());
在C#中通过webdav操作exchange        
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange            XPathNavigator xpn 
= xd.CreateNavigator();
在C#中通过webdav操作exchange            XPathExpression expr 
= xpn.Compile("//a:multistatus/a:response/a:propstat/a:prop");
在C#中通过webdav操作exchange            XmlNamespaceManager nsmgr 
= new XmlNamespaceManager(xpn.NameTable);
在C#中通过webdav操作exchange            nsmgr.AddNamespace(
"a","DAV:");
在C#中通过webdav操作exchange            nsmgr.AddNamespace(
"d","urn:schemas:calendar:");
在C#中通过webdav操作exchange            expr.SetContext(nsmgr);
在C#中通过webdav操作exchange
在C#中通过webdav操作exchange            XPathNodeIterator ni 
= xpn.Select(expr);
在C#中通过webdav操作exchange            Response.Write(ni.Count);
在C#中通过webdav操作exchange            
while (ni.MoveNext())
{
在C#中通过webdav操作exchange                
在C#中通过webdav操作exchange                
//if(ni.Current.Value != "")
{
在C#中通过webdav操作exchange                    DataRow row 
= ds.Tables[0].NewRow();
在C#中通过webdav操作exchange                    XPathNodeIterator mi 
= ni.Current.SelectChildren("displayname","DAV:");
在C#中通过webdav操作exchange                    
while(mi.MoveNext())
{
在C#中通过webdav操作exchange                        row[
"displayname"= mi.Current.Value;
在C#中通过webdav操作exchange                        
//Response.Write("[" + mi.Current.Value + "]");
在C#中通过webdav操作exchange
                    }
在C#中通过webdav操作exchange                    mi 
= null;
在C#中通过webdav操作exchange                    mi 
= ni.Current.SelectChildren("href","DAV:");
在C#中通过webdav操作exchange                    
while(mi.MoveNext())
{
在C#中通过webdav操作exchange                        row[
"href"= mi.Current.Value;
在C#中通过webdav操作exchange                        
//Response.Write("[" + mi.Current.Value + "]");
在C#中通过webdav操作exchange
                    }
在C#中通过webdav操作exchange                    mi 
= null;
在C#中通过webdav操作exchange                    mi 
= ni.Current.SelectChildren("dtstart","urn:schemas:calendar:");
在C#中通过webdav操作exchange                    
while(mi.MoveNext())
{
在C#中通过webdav操作exchange                        row[
"dtstart"= (Convert.ToDateTime(mi.Current.Value));
在C#中通过webdav操作exchange                        
//Response.Write("[" + mi.Current.Value + "]");
在C#中通过webdav操作exchange
                    }
在C#中通过webdav操作exchange                    mi 
= null;
在C#中通过webdav操作exchange                    mi 
= ni.Current.SelectChildren("dtend","urn:schemas:calendar:");
在C#中通过webdav操作exchange                    
while(mi.MoveNext())
{
在C#中通过webdav操作exchange                        row[
"dtend"= (Convert.ToDateTime(mi.Current.Value));//.AddHours(8);
在C#中通过webdav操作exchange                        
//Response.Write("[" + mi.Current.Value + "]");
在C#中通过webdav操作exchange
                    }
在C#中通过webdav操作exchange                    mi 
= null;
在C#中通过webdav操作exchange                    mi 
= ni.Current.SelectChildren("location","urn:schemas:calendar:");
在C#中通过webdav操作exchange                    
while(mi.MoveNext())
{
在C#中通过webdav操作exchange                        row[
"location"= mi.Current.Value;
在C#中通过webdav操作exchange                        
//Response.Write("[" + mi.Current.Value + "]");
在C#中通过webdav操作exchange
                    }
在C#中通过webdav操作exchange                    mi 
= null;
在C#中通过webdav操作exchange                    mi 
= ni.Current.SelectChildren("busystatus","urn:schemas:calendar:");
在C#中通过webdav操作exchange                    
while(mi.MoveNext())
{
在C#中通过webdav操作exchange                        row[
"busystatus"= mi.Current.Value;
在C#中通过webdav操作exchange                        
//Response.Write("[" + mi.Current.Value + "]");
在C#中通过webdav操作exchange
                    }
在C#中通过webdav操作exchange                    mi 
= null;
在C#中通过webdav操作exchange                    mi 
= ni.Current.SelectChildren("subject","urn:schemas:httpmail:");
在C#中通过webdav操作exchange                    
while(mi.MoveNext())
{
在C#中通过webdav操作exchange                        row[
"subject"= mi.Current.Value;
在C#中通过webdav操作exchange                        
//Response.Write("[" + mi.Current.Value + "]");
在C#中通过webdav操作exchange
                    }
在C#中通过webdav操作exchange                    mi 
= null;
在C#中通过webdav操作exchange                    mi 
= ni.Current.SelectChildren("htmldescription","urn:schemas:httpmail:");
在C#中通过webdav操作exchange                    
while(mi.MoveNext())
{
在C#中通过webdav操作exchange                        row[
"htmldescription"= mi.Current.Value;
在C#中通过webdav操作exchange                        
//Response.Write("[" + mi.Current.Value + "]");
在C#中通过webdav操作exchange
                    }
在C#中通过webdav操作exchange                    ds.Tables[
0].Rows.Add(row);
在C#中通过webdav操作exchange                }

在C#中通过webdav操作exchange
在C#中通过webdav操作exchange                
//                SpsExpendFieldData objFieldData = SpsExpendFieldData.Create(ni.Current.GetAttribute("Name",""),
在C#中通过webdav操作exchange                
//                    ni.Current.GetAttribute("ColName",""),
在C#中通过webdav操作exchange                
//                    0,
在C#中通过webdav操作exchange                
//                    ni.Current.GetAttribute("Type",""));
在C#中通过webdav操作exchange                
//                result.Add(objFieldData);
在C#中通过webdav操作exchange
                
在C#中通过webdav操作exchange            }

exchange日历中的字段列表

最近工作中遇到些烦心的事,郁闷了好几天总也开心不起来,现在想通了

开心就好

相关文章: