Wednesday, 1 February 2012

Submit multiple infopath forms to mutiple form libraries through coding

FileSubmitConnection fc = (FileSubmitConnection)this.DataConnections["Main submit"];
SPContext ctx = SPContext.Current;
string ss = ctx.Web.Url;

fc.FolderUrl = ss + "/" + "Form Library Name";
fc.Execute();

Friday, 27 January 2012

How to pass multiple repeating table field values to the text field with semi colon(;)

Eval(eval(RepeatingGp, 'concat(substring(my:Name, 1, (current() = /my:myFields/my:FieldsGp/my:RepeatingGp) * string-length(my:Name)), substring(concat(my:Name, "; "), 1, (not(current() = /my:myFields/my:FieldsGp/my:RepeatingGp)) * string-length(concat(my:Name, "; "))), ";")'), "..")


Wednesday, 25 January 2012

How to use LasIndexOf in "URL"

string projecturl = properties.WebUrl;
string targeturl = projecturl.Remove(projecturl.LastIndexOf('/'));

Example
string sp=http://sharepoint/sites/subsite1/subsite2

here I want to remove subsite2 from the above url

string newsp=sp.Remove(sp.LastIndexOf('/'));

now we get the URL as

http://sharepoint/sites/subsite1

Tuesday, 24 January 2012

How to Bind List Items to Repeating Table


}
XPathNavigator nav = this.MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:group1/my:repeatinggroup", this.NamespaceManager);
XPathNavigator NewNode = null;
if (listitems != null)
{
foreach (SPListItem ListItem in listitems)
{

NewNode = nav.Clone();
NewNode.SelectSingleNode("/my:myFields/my:group1/my:repeatinggroup/my:rtxtkeyactivities", this.NamespaceManager).SetValue(Convert.ToString(ListItem["Key Activities"]));
NewNode.SelectSingleNode("/my:myFields/my:group1/my:repeatinggroup/my:txtComp", this.NamespaceManager).SetValue(Convert.ToString(ListItem["%Comp"]));
NewNode.SelectSingleNode("/my:myFields/my:group1/my:repeatinggroup/my:dateTargettiming", this.NamespaceManager).SetValue(Convert.ToString(ListItem["Target Timing"]));
NewNode.SelectSingleNode("/my:myFields/my:group1/my:repeatinggroup/my:dateRevised", this.NamespaceManager).SetValue(Convert.ToString(ListItem["Revised Timing"]));
NewNode.SelectSingleNode("/my:myFields/my:group1/my:repeatinggroup/my:ddStatus", this.NamespaceManager).SetValue(Convert.ToString(ListItem["Status"]));
nav.InsertAfter(NewNode);

}
if (listitems.Count > 0)

nav.DeleteSelf();//Delete parent node to remove duplicate entry

Monday, 26 December 2011

Infopath Custom Date Validation

Custom Date Pattern:

Type1:
^((((19|20)(([02468][048])|([13579][26]))-02-29))|((20[0-9][0-9])|(19[0-9][0-9]))-((((0[1-9])|(1[0-2]))-((0[1-9])|(1\d)|(2[0-8])))|((((0[13578])|(1[02]))-31)|(((0[1,3-9])|(1[0-2]))-(29|30)))))

Type2:
\d{4}-\d{1,2}-\d{1,2}