MCP对 70-315 Web应用程序。NET与C#

我已经成功地通过我的第一个微软认证 70-315 成就
MCP在跟随着文件:

制定和实施与微软®的Visual C#™。NET和Microsoft®Visual Studio®中的Web应用程序。

要经过认证

考试制剂的指南

Retreiving通过在SharePoint的WebService列表内容 2003

Add the webreference to the Lists.asmx in sharepoint site.

銈://localhost/_vti_bin/Lists.asmx
(SharePoint virtual Directory URL/_vti_bin/Lists.asmx

write the following methods in your webservice.

private data.DataTable GetDataTableFromWSS(bool onlySchema)
{
string WssSiteUrl = http://192.168.111.21;
string WssSiteUrl = ConfigurationSettings.AppSettings[“WssSiteUrl”];
WssSite.Lists lists = new WssSite.Lists();
lists.Url = WssSiteUrl + “_vti_bin/Lists.asmx”;
lists.Credentials = System.Net.CredentialCache.DefaultCredentials;

lists.PreAuthenticate = true;
//you have to pass the List Name here
string CommandText = “Employee Info”;
XmlNode ListCollectionNode = lists.GetListCollection();
XmlElement List = (XmlElement)ListCollectionNode.SelectSingleNode(String.Format(“wss:名单[@Title='{0}“]”, CommandText), NameSpaceMgr);
如果 (List == null)
{
throw new ArgumentException(String.Format(“The list {0} could not be found in the site {1}”, CommandText, WssSiteUrl));
}
string TechListName = List.GetAttribute(“名称”);
data.DataTable result = new data.DataTable(“名单”);
XmlNode ListInfoNode = lists.GetList(TechListName);
System.Text.StringBuilder fieldRefs = new System.Text.StringBuilder();
System.Collections.Hashtable DisplayNames = new System.Collections.Hashtable();
的foreach (XmlElement Field in ListInfoNode.SelectNodes(“wss:Fields/wss:Field”, NameSpaceMgr))
{
如果 (Field.HasChildNodes)
{
的foreach (XmlElement Fld in Field.SelectNodes(“wss:Fields/wss:Field”, NameSpaceMgr))
{
string FieldName = Fld.GetAttribute(“名称”);
string FieldDisplayName = Fld.GetAttribute(“DisplayName”);
如果 (result.Columns.Contains(FieldDisplayName))
{
FieldDisplayName = FieldDisplayName + ” (” + fieldName的 + “)”;
}
result.Columns.Add(FieldDisplayName, TypeFromField(Field));
fieldRefs.AppendFormat(“”, fieldName的);
DisplayNames.Add(FieldDisplayName, fieldName的);
}
}
其他
{
string FieldName = Field.GetAttribute(“名称”);
string FieldDisplayName = Field.GetAttribute(“DisplayName”);
如果 (result.Columns.Contains(FieldDisplayName))
{
FieldDisplayName = FieldDisplayName + ” (” + fieldName的 + “)”;
}
result.Columns.Add(FieldDisplayName, TypeFromField(Field));
fieldRefs.AppendFormat(“”, fieldName的);
DisplayNames.Add(FieldDisplayName, fieldName的);
}
}
如果 (onlySchema) return result;
XmlElement fields = ListInfoNode.OwnerDocument.CreateElement(“ViewFields”);
fields.InnerXml = fieldRefs.ToString();
XmlNode ItemsNode = lists.GetListItems(TechListName, “”, null, 字段, “1000000”, null);
// Lookup fields always start with the numeric ID, then ;# and then the string representation.
// We are normally only interested in the name, so we strip the ID.
System.Text.RegularExpressions.Regex CheckLookup = new System.Text.RegularExpressions.Regex(“^\d ;#”);

的foreach (XmlElement Item in ItemsNode.SelectNodes(“rs:data/z:row”, NameSpaceMgr))
{
data.DataRow newRow = result.NewRow();
的foreach (data.DataColumn col in result.Columns)
{
如果 (Item.HasAttribute(“ows_” + (串)DisplayNames[col.ColumnName]))
{
string val = Item.GetAttribute(“ows_” + (串)DisplayNames[col.ColumnName]);
如果 (CheckLookup.IsMatch((串)val))
{
string valString = val as String;
val = valString.Substring(valString.IndexOf(“#”) + 1);
}
// Assigning a string to a field that expects numbers or
// datetime values will implicitly convert them
newRow[col] = val;
}
}
result.Rows.Add(newRow);
}
return result;
}

// The following Function is used to Get Namespaces

private static XmlNamespaceManager _nsmgr;
private static XmlNamespaceManager NameSpaceMgr
{
get
{
如果 (_nsmgr == null)
{
_nsmgr = new XmlNamespaceManager(new NameTable());
_nsmgr.AddNamespace(“wss”, “銈://schemas.microsoft.com/sharepoint/soap/”);
_nsmgr.AddNamespace(“与”, “uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882”);
_nsmgr.AddNamespace(“dt”, “uuid:C2F41010-65B3-11d1-A29F-00AA00C14882”);
_nsmgr.AddNamespace(“rs”, “urn:schemas-microsoft-com:rowset”);
_nsmgr.AddNamespace(“z”, “#RowsetSchema”);

}
return _nsmgr;
}
}
private Type TypeFromField(XmlElement field)
{
switch (field.GetAttribute(“Type”))
{
case “DateTime”:
return typeof(DateTime);
case “Integer”:
return typeof(int);
case “Number”:
return typeof(float);
default:
return typeof(串);
}
}

简介

你好,

我新BLOGSPOT的, 我的工作在以下Microsoft技术

  • .NET框架 1.1 / 2.0
  • .NET Framework系统
  • Microsoft Windows CE
  • Smart Device Framework
  • SharePoint Portal Server 2003
  • InfoPath中 2003

检查我的SharePoint博客

此致,
乌代.