Search
Monday, January 12, 2009
deployment administrator-approved infopath form templates
Tuesday, January 6, 2009
sharepoint web services lists
WSS Web Services
Web Reference URL
Administration
Alerts
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/alerts.asmx
Copy
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/copy.asmx
Document Workspace
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/dws.asmx
Forms
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/forms.asmx
Imaging
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/imaging.asmx
List Data Retrieval
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/dspsts.asmx
Lists
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/lists.asmx
Meetings
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/meetings.asmx
People
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/people.asmx
Permissions
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/permissions.asmx
Search
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/search.asmx
Site Data
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/sitedata.asmx
Sites
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/sites.asmx
Users and Groups
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/usergroup.asmx
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/versions.asmx
Views
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/views.asmx
Web Part Pages
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/webpartpages.asmx
Webs
http://www.MyServer/[sites/][MySite/][MySubsite/]_vti_bin/webs.asmx
How to get the full name of the user who is logged in to a asp.net website using integrated authentication
private string GetFullName(string strLogin)
{
string str = "";
// Parse the string to check if domain name is present.
int idx = strLogin.IndexOf('\\');
if (idx == -1)
{
idx = strLogin.IndexOf('@');
}
string strDomain;
string strName;
if (idx != -1)
{
strDomain = strLogin.Substring(0, idx);
strName = strLogin.Substring(idx + 1);
}
else
{
strDomain = Environment.MachineName;
strName = strLogin;
}
DirectoryEntry obDirEntry = null;
try
{
obDirEntry = new DirectoryEntry("WinNT://" + strDomain + "/" + strName);
System.DirectoryServices.PropertyCollection coll = obDirEntry.Properties;
object obVal = coll["FullName"].Value;
str = obVal.ToString();
}
catch (Exception ex)
{
str = "";
Trace.Write(ex.Message);
}
return str;
}
Monday, December 22, 2008
Query String passing in Infopath C# code
1: public void FormEvents_Loading(object sender, LoadingEventArgs e)
2: {
3: string lotNumber = string.Empty;
4: try
5: {
6: e.InputParameters.TryGetValue("LotNumber", out lotNumber);
7: }
8: catch (Exception ex)
9: {
10: lotNumber = ex.Message.ToString();
11: }
12: finally
13: {
14: MainDataSource.CreateNavigator().SelectSingleNode("//my:LotNumber", NamespaceManager).SetValue(lotNumber);
15: }
16: }
Tuesday, December 16, 2008
IIS problem XML parsing
Problem:
The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. A name was started with an invalid character. Error processing resource
Line 1... <%@ Page Language="vb" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.Framework.DefaultPage" CodeFile="Defa... Line 1...<%%@ Page Language="C#" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.Framework.DefaultPage" CodeFile="Defa... Solution: this basicly happens when IIS installed after .Net frame work. to fix this. Go to IIS manager : start -> run -> inetmgr go to your application root properties go to ASP tab make sure ASP version is not blank ( 2.0) now repair ASP.net frame work by going to control panel and change/repair.Node manipulation using Xpath C# infopath code
1: private string GetNodeValueFromMain(string xpath)
2: {
3: string retValue = string.Empty;
4: XPathNavigator retNode = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
5: if (retNode != null)
6: {
7: retValue = retNode.InnerXml;
8: }
9: return retValue;
10: }
Occasionally, the node value that you are retrieving is relative to a particular event object site (for example, a sibling node in a Changed event). In the GetNodeValueFromEvent function, the event object is passed as an argument along with the XPath statement.
1: private string GetNodeValueFromEvent(XmlEventArgs eventObject, string xpath)
2: {
3: string retValue = string.Empty; XPathNavigator retNode = eventObject.Site.SelectSingleNode(xpath, NamespaceManager);
4: if (retNode != null)
5: {
6: retValue = retNode.InnerXml;
7: }
8: return retValue;
9: }
To retrieve a node value from a secondary data source, you must pass the name of the data connection as
an argument, along with the XPath statement, as shown with the GetNodeValueFromSecondary function.
1: private string GetNodeValueFromSecondary(string source, string xpath)
2: {
3: string retValue = string.Empty; XPathNavigator retNode = DataSources[source].CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
4: if (retNode != null)
5: {
6: retValue = retNode.InnerXml;
7: }
8: return retValue;
9: }
Setting a Node Value Another task used in most managed-code solutions is setting a particular node value in the main data source. The SetNodeValueInMain function uses the first XPath statement argument to identify an XPathNavigator object and then set it to the value of the second argument.
1: private void SetNodeValueInMain(string xpath, string nodeValue)
2: {
3: XPathNavigator mainNode = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
4: if (mainNode != null)
5: {
6: mainNode.SetValue(nodeValue);
7: }
8: }
As with retrieving values, there are occasions where you might want to set a node value relative to a particular event object. Note that during certain events (for example, the Changing event), the main data source is read-only. In any
event, the SetNodeValueInEvent function uses an event object as an additional argument.
1: private void SetNodeValueInEvent(XmlEventArgs eventObject, string xpath, string nodeValue)
2: {
3: XPathNavigator eventNode = eventObject.Site.SelectSingleNode(xpath, NamespaceManager);
4: if (eventNode != null)
5: {
6: eventNode.SetValue(nodeValue);
7: }
8: }
To set a secondary data source node value, you must pass the name of the data connection as an argument, along with the XPath statement and new node value, as shown with the SetNodeValueInSecondary function.
1: private void SetNodeValueInSecondary(string source, string xpath, string nodeValue)
2: {
3: XPathNavigator secondaryNode = DataSources[source].CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
4: if (secondaryNode != null)
5: {
6: secondaryNode.SetValue(nodeValue);
7: }
8: }
Creating a Node Many times, a repeating section or repeating table control in a form
template has items added to it programmatically during the Loading event or based on specific actions at run time. The CreateNode function takes the first XPathNavigator object argument and appends the node identified by the other three arguments.
1: private void CreateNode(XPathNavigator parentNode, string childNode, string childNodePrefix, string childNodeValue)
2: {
3: if (parentNode != null)
4: {
5: parentNode.AppendChildElement(childNodePrefix, childNode, parentNode.LookupNamespace(parentNode.Prefix), childNodeValue);
6: }
7: }
Removing Nodes Whereas creating a node and adding it to a repeating section or repeating table is a common task, so too is removing a node from one of these repeating controls. The RemoveNode function takes the first XPathNavigator object argument and removes the child node identified with the second XPath
statement argument.
1:
2: private void RemoveNode(XPathNavigator parentNode, string xpath)
3: {
4: if (parentNode != null)
5: {
6: XPathNavigator childNode = parentNode.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
7: if (childNode != null)
8: {
9: childNode.DeleteSelf();
10: }
11: }
12: }
Removing all items from a repeating section or repeating table involves a reverse iteration through
an XPathNodeIterator object. Here, the RemoveChildNodes function takes the XPathNavigator object and removes all of its child nodes.
1: private void RemoveChildNodes(XPathNavigator parentNode)
2: {
3: if (parentNode != null)
4: {
5: XPathNodeIterator childNodes = parentNode.CreateNavigator().Select("*", NamespaceManager);
6: for (int i = childNodes.Count - 1; i >= 0; i--)
7: {
8: XPathNavigator childNode = parentNode.CreateNavigator().SelectSingleNode("*[last()]", NamespaceManager);
9: childNode.DeleteSelf();
10: }
11: }
12: }
Get Date Year Infopath C# code method
//You could use the substring method on a date string value
//to identify the year, month, or day values.
//In managed code, an easier way is to use the corresponding properties,
//as shown in the GetDateYear function.
private string GetDateYear(DateTime date)
{
string retValue = string.Empty;
retValue = date.Year.ToString();
return retValue;
}
