Thursday, March 10, 2011

Create virtual directory using command prompt

If you can’t access IIS Manager (INet Manager) & want to create virtual directory then run below command for create virtual directory.
There is one Window Script File for Manage Virtual Directory IISVDir.vbs located in C:\Windows\System32\iisVdir.vbs
To Create Virtual Directory run below
Iisvdir /create “IIS Web Site Name” VirtualDirName C:\PhysicalLocation


Wednesday, February 16, 2011

Access web.config in SharePoint timer job

I want to access the web application configuration (web.config) file in the SharePoint timer job. But, the limitations in SharePoint can't access the configuration files in timer job.

SharePoint web application or site will run with the help of process 'W3WP.EXE'.
SharePoint timer job is running in different process named 'OWSTIMER.EXE'.
So, the application configuration file is associated with the W3WP.EXE, so there is no way to access the web.config file in the owstimer.exe process at all. The context is completely different and out of domain. So, we need to call or access the web.config file explicitly in timer job.

So add below code in Execute() method to access ConnectionString in Timer JOB.


SPWebApplication webApplication = this.Parent as SPWebApplication;
Configuration config = WebConfigurationManager.OpenWebConfiguration("/", webApplication.Name);
_ConnString = config.ConnectionStrings.ConnectionStrings["ConnectionName"].ConnectionString.ToString();


Happy Coding !!!

Tuesday, February 1, 2011

The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file.

The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file.




Add below TAG in web.config's HttpHandler




Remove below TAG from AppSettings




Happy Coding !!!

Wednesday, January 19, 2011

Save multiple choice values in SharePoint ListItem

You will find that your checkbox list is populated with the selected value.
Save selected checkboxes in the list item as below



SPFieldMultiChoiceValue multiValue = new SPFieldMultiChoiceValue();
foreach (ListItem item in multiValueInputFormCheckBoxList.Items)
{
if (item.Selected) multiValue.Add(item.Value);
}
item["multivalued choice field name"]= multiValue;


Happy Coding !!!

Display multiple choice value of saved Listitem

Show those values which was stored in the SharePoint ListItem.
For display selected value use previous post’s “InputFormCheckBoxList”
Select listitem for display choice field’s multiple value as below



if (item["multivalued choice field name"] != null)

{

SPFieldMultiChoiceValue multiValue = new SPFieldMultiChoiceValue(item["multivalued choice field name"]);

for (int i=0; i<= multiValue.Count; i++) multiValueInputFormCheckBoxList.Items.FindByText(multiValue[i]).Selected = true; }


Happy Coding !!!