Sunday, August 30, 2009
Usefull code samples in C#
if ((e.KeyCode == System.Windows.Forms.Keys.Enter))
{
// Code for the "Enter" key
}
//Check Other Name that has Mr. & "Spaces"
public static bool IsOtherName(string strOtherName)
{
Regex Pattern = new Regex("[^a-zA-Z\\.\\ ?]");
return !Pattern.IsMatch(strOtherName);
}
// String format for "Money"
String.Format("{0:0,0.00}", objRenewal.policy.dblPremium.ToString())
Tuesday, August 18, 2009
Tuesday, July 28, 2009
Sharepoint 2010 Overview
It's time to have a look new features that we want in sharepoint !!!
- Look & Feel (Ribbon Control)
- Multi document Checkout + avoid from post backs
- Nice pop-up windows than response.redirects J
- Direct uploading & showing images from your computer to sharepoint
- SilverLight webpart
- Nice themes like "PowePoint Theme"
- Visio services running with sharepoint services (Visio is not necessary)
- Fully rich Sharepoint Designer
- Entities to connect SQL,LOB with Edit/Delete functions (OOB)
- Direct connect to the office tools like Office 2010 with a click J
Change the data in a Infopath form library programatically
(1) We should allow unsafe upates = true
(2) We should check out the file

SPSite objSite = new SPSite("http://sharepointsvr:123/");
SPWeb objWeb = objSite.RootWeb;
SPFolder oFolder = objWeb.GetFolder("Participant");
SPFileCollection collFiles = oFolder.Files;
foreach (SPFile oFile in collFiles.Folder.Files)
{
SPListItem oListItem = oFile.Item;
oListItem.File.CheckOut();
oListItem["ProgramaticField"] = "Chanaka has done it";
oListItem.SystemUpdate();
oListItem.File.CheckIn("chana did");
Thursday, July 23, 2009
Sharepoint hints
http://sharepointsvr:15613/_vti_bin/lists.asmx
How I enable Anonymous+Access
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhExfqTp8opjEIK37d5Ak4m23971jeqCoa4-EHhSnu0oqx4lViqvpxT63woZntJ6w5PBKMds_vztzOULvs4wjiZdLxi6CEtipwWKv9thleI2Y4oy5wefeeXxUcVo1W1iK4IYNsUOujojU0/s1600-h/Anonymous+Access.JPG
Get the response of web request programatically
HttpWebRequest httpRequest = null;
httpRequest = (HttpWebRequest)WebRequest.Create("http://172.21.0.60:8034/");
httpRequest.Method = "GET"; // User get data
HttpWebResponse webResponse = null;
webResponse = (HttpWebResponse)httpRequest.GetResponse();
Encoding enc = Encoding.Default;
responseReader = new StreamReader(webResponse.GetResponseStream(), enc);
String temp = responseReader.ReadToEnd();
Wednesday, July 22, 2009
Infopath data retrieve with Sharepoint
SPWeb objWeb = objSite.RootWeb;
SPList objList = objWeb.Lists["Participant"];
SPQuery objQuery = new SPQuery ();
SPListItemCollection objCollection = objList.GetItems(objQuery);
SPListItem objItem = objCollection[0];
SPFile objFile = objItem.File;
byte[] xmlFormData = objFile.OpenBinary();
XPathDocument ipForm = null;
using (MemoryStream ms = new MemoryStream(xmlFormData))
{
ipForm = new XPathDocument(ms);
ms.Close();
}
XPathNavigator ipFormNav = ipForm.CreateNavigator();
XPathNavigator nodeNav = ipFormNav.SelectSingleNode("/my:myFields/my:fldFamilyName", GetFormNSM(ipForm));
string strValue = nodeNav.InnerXml;
Response.Write(strValue);
//XML Namespace Creator
private XmlNamespaceManager GetFormNSM(XPathDocument ipForm)
{
const string strMYNamespacePrefix = "my";
const string strMYNamespaceURI = "http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-06-25T10:50:10";
const string strDIRNamespacePrefix = "d";
const string strDICNamespaceURI = "http://schemas.microsoft.com/sharepoint/soap/directory/";
XPathNavigator formAccess = ipForm.CreateNavigator();
XmlNamespaceManager namespaceMngr = new XmlNamespaceManager(formAccess.NameTable);
namespaceMngr.AddNamespace(strMYNamespacePrefix, strMYNamespaceURI);
namespaceMngr.AddNamespace(strDIRNamespacePrefix, strDICNamespaceURI);
return namespaceMngr;
}
Monday, July 13, 2009
RunWithElevatedPrivileges in sharepoint
Solution is:::::
SPSecurity.RunWithElevatedPrivileges(delegate()
Sometimes even we add this delegate still it's not working.
That's because the object we are using made without elevated privileges.
(Ex:- We are creating SPWeb under the delegate, but the SPSite(parent object) object is outside the delegate, then we won't get chance to access data)
Monday, June 15, 2009
Sharepoint backup & restore using STSADM
C:\Documents and Settings\Administrator>cd C:\Program Files\Common Files\Microso
ft Shared\web server extensions\12\bin
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o backup -url http://sharepoint:5555/ -filename chana.bak
///Chana.bak is the name back up file
Operation completed successfully.
//// get the file from ‘12\bin\’ folder in development machine
//// transfer to the SERVER & put into ‘12\bin\’
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o restore -url http://sharepoint:5555/ -overwrite -filename chana.bak
Operation completed successfully.
Monday, May 25, 2009
My Career After One Year + My Interests In Next Year
What we did more, other than sharepoint branding & small customization
(1) ( 1) Build using feature
(2) (2) Fire feature activation events & add tracking
(3) (3) Configure RMS (Rights Management Server)
(4) (4) Change whole master pages using features & SPD (Sharepoint Designer)
(5) (5) Add Ajax enable webparts into sharepoint sites
(6) (6) Active directory users migration using SSP
We did workflows other than simple approval workflows
(1) (1) Dynamic workflows (No of levels)
(2) (2) Dynamic approvers (different approvers)
(3) (3) Configure SSL
(4) (4) Reports generations using SSRS
(5) (5)Creating Collect feedback, Collect signature workflows
(6) (6) InfoPath forms integration using X-Path to workflows



