I'm connecting to an exchange public folder and pulling out contacts via XML.
I can use the .responseText to view the text string. The response from
Exchange in this string is formatted in XML. I'm trying to figure out what I
could use to parse the info out of the response because I need to write the
values to SQL.
Here's the code:
try
{
MSXML2.XMLHTTP4 0 oXMLHttp = new MSXML2.XMLHTTP4 0();
//TODO: To list items, uncomment "const bool bListItems = false;"
// const bool bListFolders = true;
const bool bListItems = false;
String sUrl;
//TODO: Replace ExchServer with your Exchange server and UserAlias with
your user alias.
sUrl= "http://cartman/public";
oXMLHttp.open(" SEARCH", sUrl, false, "n-sv\\kris", "28273De,") ;
//TODO: Use this query to list items.
String sQuery;
sQuery = "<?xml version='1.0'?> " +
"<g:searchreque st xmlns:g='DAV:'> " +
"<g:sql>SEL ECT \"DAV:displayna me\", \"DAV:creationd ate\",
\"urn:schemas:c ontacts:telepho neNumber\" " +
"FROM SCOPE('SHALLOW TRAVERSAL OF \"" + sUrl + "\"')" +
" WHERE \"DAV:isfolder\ " = " + bListItems.ToSt ring()+
"</g:sql>" +
"</g:searchrequest >";
/*
//TODO: Use this query to list folders.
String sQuery;
sQuery = "<?xml version='1.0'?> " +
"<g:searchreque st xmlns:g='DAV:'> " +
"<g:sql>SEL ECT \"DAV:displayna me\" " +
"FROM SCOPE('SHALLOW TRAVERSAL OF \"" + sUrl + "\"')" +
" WHERE \"DAV:isfolder\ " = " + bListFolders.To String() +
"</g:sql>" +
"</g:searchrequest >";
*/
oXMLHttp.setReq uestHeader("Con tent-Type", "text/xml");
oXMLHttp.setReq uestHeader("Tra nslate", "f");
oXMLHttp.setReq uestHeader("Con tent-Length", "" + sQuery.Length);
Console.WriteLi ne(sQuery);
oXMLHttp.send(s Query);
// Need to create a stream to pass to the XmlTextReader
// stream = new StringReader(oX MLHttp.response XML.ToString()) ;
// xtr = new XmlTextReader(s tream);
// xtr.WhitespaceH andling = WhitespaceHandl ing.All;
txtResults.Text = oXMLHttp.respon seText;
// if(xtr.Read())
// txtResults.Text = xtr.NodeType.To String() +
xtr.Name.ToStri ng() + xtr.Value.ToStr ing();
// probably take and return the status number to a literal
// 207 seems to indicate good possibly describe the others
Console.WriteLi ne(oXMLHttp.sta tus);
Console.WriteLi ne(oXMLHttp.sta tusText);
Console.WriteLi ne(oXMLHttp.res ponseText);
}
catch (Exception ex)
{
Console.WriteLi ne("{0} Exception caught.", ex);
} 1 2893 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: |
last post by:
Hi,
I need to read a big CSV file, where different fields should be converted to
different types,
such as int, double, datetime, SqlMoney, etc.
I have an array, which describes the fields and their types. I would like
to somehow store a reference to parsing operations in this array
(such as Int32.Parse, Double.Parse, SqlMoney.Parse, etc),
so I can invoke the appropriate one without writing a long switch.
|
by: Samuel |
last post by:
Hello,
I am trying to convert a local time into UTC ISO8601, then parse it
back into local time. I tried the following:
----------------------
#!/usr/bin/python
import time
import datetime
import xml.utils.iso8601
|
by: Bob Rundle |
last post by:
I would like to get something like this to work...
Type t = FindMyType(); // might be int, float, double, etc
string s = "1233";
object v = t.Parse(s);
This doesn't work of couse, Parse is not a member of Type.
I have to think that this is possible. Is it?
|
by: c0uch |
last post by:
the first and third methods are in a usercontrol object.
txtValue is a TextBox
the float.parse in the if statement on line 3 always works fine.
the second float.parse in the third method is quirky: if the program just
runs it will always break on that line, vc# 2005 beta2 shows txtValue.Text as
null at this point.
However, if I put a breakpoint on the first float.parse (on line 3), and
then step out until i reach the second float.parse,...
|
by: Kevin Kenny |
last post by:
Dear All,
I have a date time validation method thus:
public static bool IsDate(string date, System.IFormatProvider provider) {
try {
DateTime.Parse(date, provider)
return true;
} catch (System.FormatException)
return false;
| |
by: Slonocode |
last post by:
I have some textboxes bound to an access db. I wanted to format the
textboxes that displayed currency and date info so I did the following:
Dim WithEvents oBidAmt As Binding
oBidAmt = New Binding("Text", Me.Ds1, "Items.BidAmt")
txtBidAmt.DataBindings.Add(oBidAmt)
Private Sub oBidAmt_Format(ByVal sender As Object, ByVal e As
System.Windows.Forms.ConvertEventArgs) Handles oBidAmt.Format
|
by: Douglas Crockford |
last post by:
There is a new version of JSON.parse in JavaScript. It is vastly
faster and smaller than the previous version. It uses a single call to
eval to do the conversion, guarded by a single regexp test to assure
that it is safe.
JSON.parse = function (text) {
return
(/^(\s|]|"(\\|)*"|-?\d+(\.\d*)?(?\d+)?|true|false|null)+$/.test(text))
&& eval('(' + text + ')');
};
|
by: MMiGG |
last post by:
Hi
Our project need parse JAVA serialized object string in C, has any library?
Thanx
|
by: js |
last post by:
I have a textbox contains text in the format of "yyyy/MM/dd hh:mm:ss".
I need to parse the text using System.DateTime.Parse() function with
custom format. I got an error using the following code. Could someone
help me with the customization? Thanks.
String was not recognized as a valid DateTime. at
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi,
DateTimeStyles styles) at System.DateTime.Parse(String s,
IFormatProvider...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |