Showing posts with label sharepoint. Show all posts
Showing posts with label sharepoint. Show all posts

Friday, March 8, 2013

Clear cache of infopath 2010

To clear the cache of info path 2010..Run the following command in 'Run'

Infopath /cache clearall


Wednesday, September 9, 2009

Wednesday, August 26, 2009

Deleting an item from sharepoint list

If you would like to delete an item from SPListItemCollection in share point,
Use the following code


SPSite site = null;
SPWeb web = null;

try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
site = SPContext.Current.Site;
site.AllowUnsafeUpdates = true;
web = site.OpenWeb();
SPList list = web.Lists["Test"];
SPQuery oQuery = new SPQuery();
oQuery.Query = "" + txtGaugeID.Text + "";
SPListItemCollection oDeleteCollection = list.GetItems(oQuery);
if (oDeleteCollection.Count > 0)
{

for (int i = oDeleteCollection.Count - 1; i > -1; i--)
{
oDeleteCollection.Delete(i);
}
}
});

}
catch (Exception ex)
{
Response.Write(ex.Message);
}

Monday, July 27, 2009

Blocking anonymous users from sharepoint lists

To block the anonymous users from viewing the sharepoint lists add the following code in your web.config file

[CODE][location path="lists"]
[system.web]
[authorization]
[deny users="?"]
[/authorization]
[/SYSTEM.WEB]
[/location][/CODE}

Friday, July 24, 2009

How to integrate outlook calendar items in sharepoint?

Just follow the following code to view your out look items in sharepoint.
To see the inbox items

//'OBJECT classid="CLSID:0006F063-0000-0000-C000-000000000046" width="100%" style="height: 400px"'

To integrate the outlook calendar

//'OBJECT classid="CLSID:0006F063-0000-0000-C000-000000000046" width="100%" style="height: 400px"'

use the '<>' instead of //


Saturday, June 13, 2009

Reading data from sharepoint customlist


Here I explained a simple program for sharepoint beginners which states that reading a data from custom list and bind it to a dropdownlist.

first we have to add microsoft sharepoint dll to our application and import the following name space.

using Microsoft.SharePoint;

declare the following parameters globally.

SPSite objSite;
SPWeb oWeb;
SPList regList
;


and bind the data like this


objSite = new SPSite(SPContext.Current.Site.ID);
oWeb = objSite.OpenWeb("/sitename/");


regList = oWeb.Lists["listname"];
SPListItemCollection oItems = regList.Items;


dt = new DataTable();
dt = oItems.GetDataTable();
ddlTypeCourses.DataSource = dt;
ddlTypeCourses.DataTextField = "Title";
ddlTypeCourses.DataValueField = "Title";
//ddlTypeCourses.Items.Add(new ListItem("-select-", "0"));
ddlTypeCourses.DataBind();
ddlTypeCourses.Items.Insert(0, new ListItem("---Select Course Types---", "0"));