Web storage system + WebDAV

Source: Internet
Author: User
Tags addchild

Title: Web storage system + WebDAV

Keyword: WebDAV

Link: http://blog.csdn.net/jrq/archive/2007/02/08/1504984.aspx

1. Web storage system ):

Exchange web storage is a database technology used to store, share, and manage heterogeneous data, such as emails, web pages, multimedia files, and Microsoft Office XP documents.

A Web storage system is like a traditional file system, which is organized by folders.

Each folder in the Web storage system can contain any number of items, including other folders.

Many protocols and applications can be used.ProgramProgramming interface (API) (including Hypertext Transfer Protocol (HTTP) and WebDAV (HTTP/WebDAV), Microsoft ActiveX Data Object version 2.5 (ADO), ole db version 2.5, Exchange 2000 collaborative data object (cdoex), message processing API (mapi )) access items in the Web storage system through a file system and using a variety of other industry-standard wired protocols.

The Web storage system provides a repository for managing emails, documents, web pages, and other resources in a single infrastructure to integrate knowledge sources.

The Web storage system supports remote client access and Some APIs. In addition, the Web storage system acts as a unified messaging platform where knowledge workers can access private information such as calendar and contacts via email and voice mail.

The Web storage system provides enterprise-based application services in the following three aspects:

Common Client Access-clients (such as Office) can read and write documents and store stream data (such as audio and video ). The Web storage system includes data models that support hierarchical sets (folders) and heterogeneous sets (folders of any file type are acceptable.

The next-generation database-web storage system provides the next-generation database service, which can store various types of information in a single repository. Information contained in the web Storage System database can be different types of data, such as from ole db and ActiveX Data Object (ADO) record set to mime mail and Extensible Markup Language (XML) data. The Web storage system also provides database services such as atomic updates. If the update involves multiple items in the Web storage system, these services will display a consistent view for the end user.

The rich development platform-web storage system supports message transmission, contacts, calendars, workflows, groups, and real-time collaboration.

2. WebDAV

Distributed creation and version management are used to access the project protocols in the Microsoft Web storage system. It provides a method to access project content and extended property sets. HTTP/WebDAV protocol.

3. Use the Web storage system resource manager:

3. 1. Click the start button to point to programs and web storage system SDK, and then to Web storage system tools ".

. Click "Web storage system Explorer" to open the WSS Resource Manager.

3. 3. in the "Authorization" dialog box, enter your user name and password, use the account certificate with the appropriate permissions, and specify the URL in the form of http: // <yourserver>/public.

3.4.wss resource manager will be started.

 

4. WebDAV operations in D7CodeExample:

VaR webpath, webdomain, webuser, password: string;

Uses comobj;

Procedure writelog (const logstr: string );
VaR F: textfile;
Begin
If logstr <> ''then // write the log file
Begin
Assignfile (F, extractfilepath (paramstr (0) + 'Log/message' + formatdatetime ('yyyy-mm-dd', now) + '. log ');

If not fileexists (extractfilepath (paramstr (0) + 'Log/message' + formatdatetime ('yyyy-mm-dd', now) + '. log') then
Begin
Rewrite (f); // create a new file for writing;
Writeln (F, '[' + formatdatetime ('yyyy-mm-dd hh: mm: ss', now) + ']:' + logstr );
Closefile (f );
End
Else
Begin
Append (f );
If logstr = ''then
Writeln (F ,'')
Else
Writeln (F, '[' + formatdatetime ('yyyy-mm-dd hh: mm: ss', now) + ']:' + logstr );
Closefile (f );
End;
End;
End;

Procedure addchild (xmldom, tagname, namespace, nodevalue,
Ndlevel: variant );
VaR objchildnode, objparentnode: variant;
I: integer;
Begin
Objchildnode: = xmldom. createnode (1, tagname, namespace );
Objchildnode. Text: = nodevalue;

If (xmldom. haschildnodes) and (ndlevel> 1) then
Begin
Objparentnode: = xmldom. lastchild;

For I: = 0 to ndlevel-3 do
If (objparentnode. haschildnodes) then
Objparentnode: = objparentnode. lastchild;

Objparentnode. appendchild (objchildnode );
End
Else
Begin
Xmldom. appendchild (objchildnode );
End;

Objparentnode: = NULL;
Objchildnode: = NULL;
End;

Procedure savefieldusingwebdav (messageurl, fieldname, namespace,
Fieldvalue: variant );
VaR axmldoc, axmlhttp: variant;
Begin
Axmlhttp: = createoleobject ('msxml2. xmlhttp.3.0 ');
Axmldoc: = createoleobject ('msxml2. domdocument.3.0 ');

Addchild (axmldoc, 'd: propertyupdate', 'dav: ', '', 1 );
Addchild (axmldoc, 'd: set', 'dav: ', '', 2 );
Addchild (axmldoc, 'd: prop ', 'dav:', '', 3 );
Addchild (axmldoc, fieldname, namespace, fieldvalue, 4 );

Axmlhttp. Open ('proppatch ', messageurl, false, webdomain +'/'+ webuser, password );
Axmlhttp. setRequestHeader ('content-type', 'text/XML; charset = ''utf-8 ''');
Axmlhttp. setRequestHeader ('overwrite', 'T ');
Axmlhttp. setRequestHeader ('translate', 'F ');
// Axmldoc. Save (extractfilepath (paramstr (0) + 'C. xml ');
Axmlhttp. Send (axmldoc );

Axmlhttp: = NULL;
Axmldoc: = NULL;
End;

Procedure setmessageproperty (messageurl, namespace, tagname,
Value, domain, username, password: variant );
VaR XMLHTTP, strwebdav: variant;
Astr: string;
Begin
XMLHTTP: = createoleobject ('msxml2. xmlhttp.3.0 ');
Strwebdav: = '';
If (namespace = 'dav') or (namespace = 'dav: ') then
Begin
Strwebdav: = strwebdav + '<D: propertyupdate xmlns: D = ''dav: ''> ';
Strwebdav: = strwebdav + '<D: Set> ';
Strwebdav: = strwebdav + '<D: prop> ';
Strwebdav: = strwebdav + '<D:' + tagname + '>' + value + '</D:' + tagname + '> ';
Strwebdav: = strwebdav + '</D: prop> ';
Strwebdav: = strwebdav + '</D: Set> ';
Strwebdav: = strwebdav + '</D: propertyupdate> ';
End
Else
Begin
Strwebdav: = strwebdav + '<D: propertyupdate xmlns: D = ''dav: ''xmlns: M ="' + namespace + '"> ';
Strwebdav: = strwebdav + '<D: Set> ';
Strwebdav: = strwebdav + '<D: prop> ';
Strwebdav: = strwebdav + '<m:' + tagname + '>' + value + '</M:' + tagname + '> ';
Strwebdav: = strwebdav + '</D: prop> ';
Strwebdav: = strwebdav + '</D: Set> ';
Strwebdav: = strwebdav + '</D: propertyupdate> ';
End;

Astr: = messageurl;

XMLHTTP. Open ('proppatch ', astr, false, webdomain +'/'+ webuser, password );
XMLHTTP. setRequestHeader ('content-type', 'text/XML; charset = ''utf-8 ''');
XMLHTTP. setRequestHeader ('translate', 'F ');
// Writelog (strwebdav );
XMLHTTP. Send (strwebdav );
End;

procedure tform1.button1click (Sender: tobject);
var count, I, j: integer;
XMLHTTP, xmldoc, xmlnode, WebDAV: variant;
websql: widestring;
currentflow, gdname, gdbz, tmpstr: string;
flowlist: tstringlist;
begin
XMLHTTP: = createoleobject ('msxml2. xmlhttp.3.0 ');
xmldoc: = createoleobject ('msxml2. domdocument.3.0 ');

webpath: = 'HTTP: // ex01/public/workflow/'; // exchange service address
webdomain: = 'hebmc. com '; // domain
webuser: = 'oawebuser'; // domain account
password: = 'chenzuooaup02'; // domain account password
gdname: = 'hastothams20070112 '; // tag
gdbz: = 'true'; // tag value

// use the WebDAV query statement.
websql: = 'select "Dav: displayname" from "'+ webpath +'" where ("Dav: contentclass" = ''urn: Content-classes: folder '') or (" Dav: contentclass "= ''urn: Content-classes: mailfolder'') ';
WebDAV: =' '+ websql +' ';
{< br> WebDAV: = ' select "Dav: displayname" from "http: // ex01/public/workflow/"where (" Dav: contentclass "= ''urn: Content-classes: folder'') or ("Dav: contentclass "= ''urn: Content-classes: mailfolder'') ';
}

// search for all the process names in the System
try
XMLHTTP. open ('search', webpath, false, webdomain + '/' + webuser, password);
XMLHTTP. setRequestHeader ('content-type', 'text/XML; charset = ''utf-8''');
XMLHTTP. setRequestHeader ('dest', '0');
XMLHTTP. setRequestHeader ('translate', 'F');
XMLHTTP. send (webDAV); // WebDAV query
xmldoc. load (XMLHTTP. responsexml); // get the returned value
// xmldoc. save (extractfilepath (paramstr (0) + 'a. xml');

// obtain the name of all processes in the system.
xmlnode: = xmldoc. documentelement. selectnodes ('a: Response/A: propstat/A: prop');
failed t on E: exception do
writelog (E. message);
end;
flowlist: = tstringlist. create;
// Add the process name to the List
for Count: = 0 to xmlnode. length-1 do
flowlist. add (xmlnode. item [count]. childnodes (0 ). text);


// Process Loop
for Count: = 0 to flowlist. count-1 do
begin
currentflow: = trim (flowlist [count]);
websql: = 'select "Dav: href ", "Copy ID", "Dav: displayname", "sender No. $", "confidentiality $", "organizer $", "subject $ ", "receiving authority $", "issuing company $ ", "Communications Authority $" '+
' from "'+ webpath + currentflow +'/handled email '+'" '+
'where (((" dav: contentclass "= ''urn: Content-classes: message') and (" '+ gdname +' "is null) or (" '+ gdname + '"! = ''' + Gdbz + ''') and ("kdbz" is null) or ("kdbz" = ''n '')))';

WebDAV: = '<D: searchrequest xmlns: D = "Dav:"> <D: SQL>' + websql + '</D: SQL> </D: searchrequest> ';

Try
XMLHTTP. Open ('search', webpath, false, webdomain + '/' + webuser, password); // WebDAV Search
Except t on E: exception do
Writelog (E. Message );
End;

try
XMLHTTP. setRequestHeader ('content-type', 'text/XML; charset = ''utf-8''');
XMLHTTP. setRequestHeader ('dest', '0');
XMLHTTP. setRequestHeader ('translate', 'F');
XMLHTTP. send (webDAV);
xmldoc. load (XMLHTTP. responsexml);
// xmldoc. save (extractfilepath (paramstr (0) + 'B. xml');

// Obtain all entry nodes in a process.
Xmlnode: Export xmldoc.doc umentelement. selectnodes ('a: Response/A: propstat/A: prop ');
Except t on E: exception do
Writelog (E. Message );
End;

// Attributes (subnodes) in the entry node cycle
For I: = 0 to xmlnode. Length-1 do
Begin
For J: = 0 to xmlnode. item [I]. childnodes. Length-1 do
Begin
Tmpstr: = xmlnode. item [I]. childnodes (j). Text; // get the attribute content
// You can perform other operations on tmpstr, such as saving it to the database.
End; // For J: = 0

// After the entry node is processed, write the processed tag.
Try
Setmessageproperty (xmlnode. item [I]. childnodes (0). Text, '', gdname, gdbz, webdomain, webuser, password );
Except t on E: exception do
Begin
Writelog (E. Message );
Continue;
End;
End;

Try
Savefieldusingwebdav (xmlnode. item [I]. childnodes (0). Text, gdname, '', gdbz );
Except t on E: exception do
Begin
Writelog (E. Message );
Continue;
End;
End;
End; // For I: = 0 to xmlnode. Length-1 do
End; // For Count: = 0 to flowlist. Count-1 do

Freeandnil (flowlist );
Xmlnode: = NULL;
Xmldoc: = NULL;
XMLHTTP: = NULL;

End;

End.

5. refer:

Http://msdn.microsoft.com/library/chs/default.asp? Url =/library/CHS/modcore/html/deconworkingwithexchangewebstore. asp

Http://www.microsoft.com/china/MSDN/library/archives/library/techart/wssformsreg_v4.asp

Http://www.microsoft.com/china/MSDN/library/archives/MSDNonline/features/articles/newdevfeaturese2k.asp

 
By jrq

2007/02/07 xueyu Shi · Mobile

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.