17 February 2011

Advantages of MOSS 2007

* User Interface (UI) and navigation enhancements
* Document management enhancements
* The new Workflow engine
* Office 2007 Integration
* New Web Parts
* New Site-type templates
* Enhancements to List technology
* Web Content Management
* Business Data Catalog
* Search enhancements
* Report Center
* Records Management
* Business Intelligence and Excel Server
* Forms Server and InfoPath
* The ?Features? feature
* Alternate authentication providers and Forms-based authentication

19 January 2011

Steps to search a single document library

Side Note: This must be done at the site collection level or administration level. Also, you must have full control of your site collection.
Step 1: Go to "Site Actions", "Site Settings" and under "Site Collection Administration" click on "Search Scopes".

Step 2: Click on "New Scope" and give it a title. Usually the document library you wish to search. Click "OK"

Step 3: Now we need to add a rule. Go to the document library you wish to search and grab the URL. Then repeat Step 1 to get back to the search scope settings page. Click on the search scope you created in Step 2. Under the "Rules" section click on "New Rule". Select "Web Address" and enter the URL of your document library. Click "OK".

Step 4: Click on "New Display Group" and give it a title and a description. In the "Scopes" section select the scope you created in Step 2. The "Default Section" should automatically become the scope you selected.

Step 5: Wait for the server to recognize the new scope and display group.

Step 6: Go back to the page you wish to add a search box. Go to "Site Actions", "Edit Page", click on "Add a Web Part". Select the "Search Box" web part and click "Add".

Step 7: The page should be in "Edit Mode". In the "Search Box" web part click on the "edit" button and go to "Modified Shared Web Part".

Step 8: Expand the "Miscellaneous" section. Uncheck "Use site level defaults". In the "Scope Display Group" sub-section the default display group scope will be "Search Dropdown" change this to the display group you created in Step 4. You cannot browse through the display groups so you will have to type your display group in exactly. Click on "OK".

Step 9: Exit out of "Edit Mode". Your search box should now have the new search scope you created in Step 2 as the default choice.
Side Note: Test the search. If it does not work you might need to contact the Site Adminstrator to enable your scope and display group or index(crawl) your document library for the search to work.

18 January 2011

OnClick Event in SharePoint

To allow OnClick and OnCommand event in SharePoint add this script into web.config file

< SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">
< PageParserPaths>
< PageParserPath VirtualPath="/amu2/*" CompilationMode="Always" AllowServerSideScript="true" />
</PageParserPaths >
</SafeMode>

17 January 2011

Remote sharepoint debugging

To debug the share point code remotely, please visit the below weblink

http://msdn.microsoft.com/en-us/library/bt727f1t(VS.80).aspx

05 January 2011

Avoid authentication in Sharepoint

To avoid authentication in some cases write code between these below code..

 

 

SPSecurity.RunWithElevatedPrivileges(delegate()

{

//Code.. or Functionality                  

 

}

);

 

04 January 2011

Enable Paging in repeater control

Page indexing in repeater

//declare PgNum as public integer

public int PgNum
{
get
{
if (ViewState["PgNum"] != null)
return Convert.ToInt32(ViewState["PgNum"]);
else
return 0;

}
set { ViewState["PgNum"] = value; }

}

// write below code where you are assigning the data source to the repeater

PagedDataSource pgds = new PagedDataSource();
pgds.DataSource = Rs//Assign data here which you want to assign to repeater, Here Rs is the list data source
pgds.AllowPaging = true;
pgds.PageSize = 4;
pgds.CurrentPageIndex = PgNum;

int PgCount = Rs.Count;
int vcnt = PgCount / pgds.PageSize;
if (PgNum < 1)
lnkPrev.Visible = false;
else if (PgNum > 0)
lnkPrev.Visible = true;

if (PgNum == vcnt)
lnkNxt.Visible = false;
else if (PgNum < vcnt)
lnkNxt.Visible = true;

rptPosts.DataSource = pgds;
rptPosts.DataBind();

Sorting in List<> Generics in Csharp

Sorting in List<> Generics in Csharp


// Create Resource class with variables(Members)
public class Resources
{
public string Name { get; set; }
public string url { get; set; }
public int id { get; set; }
public string Image { get; set; }
public string post { get; set; }
public DateTime Createddate { get; set; }
public string ListName { get; set; }


public static int Comparedate(Resources r1, Resources r2)
{
// To display in descending order multiply with -1
return r1.Createddate.CompareTo(r2.Createddate) * -1;
}
}

List Rs = new List();


Add values to the list as below.

Resources r2 = new Resources();
r2.post = PostItem["Title"].ToString();
r2.Name = "";
r2.url = "";
r2.Image = ImageUrl.ToString();
r2.id = PostItem.ID;
r2.Createddate = Convert.ToDateTime(PostItem["Created"]);
r2.ListName = "Posts";
Rs.Add(r2);



Resources r3 = new Resources();
if (postedLink["Notes"] != null)
r3.post = postedLink["Notes"].ToString();
r3.Name = postedLink["URL"].ToString().Substring(0, postedLink["URL"].ToString().IndexOf(','));
r3.url = postedLink["URL"].ToString().Substring(0, postedLink["URL"].ToString().IndexOf(','));
r3.Image = ImageUrl.ToString();
r3.id = postedLink.ID;
r3.Createddate = Convert.ToDateTime(postedLink["Created"]);
r3.ListName = "Links";
Rs.Add(r3);

Comparison ComparedList = new Comparison(Resources.Comparedate);

Rs.Sort(ComparedList);

Assign ‘Rs’list to the repeater or gridview.

Source: http://shafaqat309.wordpress.com/2009/05/04/sorting-generic-collections-list-in-cnet-net-2-0-net-3-5-c-classes-collections-generics-sorting/

Enable Paging in repeater control

Page indexing in repeater

 

//declare PgNum as public integer

 

public int PgNum

        {

            get

            {

                if (ViewState["PgNum"] != null)

                    return Convert.ToInt32(ViewState["PgNum"]);

                else

                    return 0;

 

            }

            set { ViewState["PgNum"] = value; }

 

        }

 

// write below code where you are assigning the data source to the repeater

 

PagedDataSource pgds = new PagedDataSource();

                    pgds.DataSource = Rs//Assign data here which you want to assign to repeater, Here Rs is the list data source

                    pgds.AllowPaging = true;

                    pgds.PageSize = 4;

                    pgds.CurrentPageIndex = PgNum;

 

int PgCount = Rs.Count;

int vcnt = PgCount / pgds.PageSize;

                    if (PgNum < 1)

                        lnkPrev.Visible = false;

                    else if (PgNum > 0)

                        lnkPrev.Visible = true;

 

                    if (PgNum == vcnt)

                        lnkNxt.Visible = false;

                    else if (PgNum < vcnt)

                        lnkNxt.Visible = true;

 

                    rptPosts.DataSource = pgds;

                    rptPosts.DataBind();

Sorting in List<> Generics in Csharp

Sorting in List<> Generics in Csharp

 

 

// Create Resource class with variables(Members)

public class Resources

        {

            public string Name { get; set; }

            public string url { get; set; }

            public int id { get; set; }

            public string Image { get; set; }

            public string post { get; set; }

            public DateTime Createddate { get; set; }

            public string ListName { get; set; }

 

 

            public static int Comparedate(Resources r1, Resources r2)

            {

// To display in descending order multiply with -1

                return r1.Createddate.CompareTo(r2.Createddate) * -1;

            }

        }

 

List<Resources> Rs = new List<Resources>();

 

 

Add values to the list as below.

 

Resources r2 = new Resources();

                            r2.post = PostItem["Title"].ToString();

                            r2.Name = "";

                            r2.url = "";

                            r2.Image = ImageUrl.ToString();

                            r2.id = PostItem.ID;

                            r2.Createddate = Convert.ToDateTime(PostItem["Created"]);

                            r2.ListName = "Posts";

                            Rs.Add(r2);

 

 

 

Resources r3 = new Resources();

                            if (postedLink["Notes"] != null)

                                r3.post = postedLink["Notes"].ToString();

                            r3.Name = postedLink["URL"].ToString().Substring(0, postedLink["URL"].ToString().IndexOf(','));

                            r3.url = postedLink["URL"].ToString().Substring(0, postedLink["URL"].ToString().IndexOf(','));

                            r3.Image = ImageUrl.ToString();

                            r3.id = postedLink.ID;

                            r3.Createddate = Convert.ToDateTime(postedLink["Created"]);

                            r3.ListName = "Links";

                            Rs.Add(r3);

 

Comparison<Resources> ComparedList = new Comparison<Resources>(Resources.Comparedate);

 

Rs.Sort(ComparedList);

 

Assign ‘Rs’list to the repeater or gridview.

 

Source: http://shafaqat309.wordpress.com/2009/05/04/sorting-generic-collections-list-in-cnet-net-2-0-net-3-5-c-classes-collections-generics-sorting/

 

27 December 2010

Allow onclick event in Sharepoint

Add below code in web config file

between the ..................... tag







Note:
/amu2/* is the web site URL