Sharepoint Tips


Response Redirect in a web part
A:- Try going to Page.Response (or SPUtility.Redirect() indeed)
System.Web.HttpContext.Current.Response.Redirect([URL Link]);
SPUtility.Redirect("login.aspx", SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current);

Getting the URL Query string values in a Web Part
A:-the way to use this is Context.Request[string key name]ToString();
string kquery = Page.Request.QueryString["kqry"];

New in SharePoint 2010 CAML Query <IN>,<INCLUDES> &< NOT INCLUDES>
Even though Microsoft encourages using LINQ in SharePoint 2010, they introduced some new CAML Query schema elements. They are
· IN
· INCLUDES
· NOT INCLUDES

IN:

This is something work as same as what we see in SQL Query. We can provide a collection of Items to filter. Previously in SharePoint 2007 we have to use OR operator to do this.. But using OR for multiple times for multiple values will lead to lack in code clarity. So IN operator is considering as good.
The above can be written in SharePoint 2010 as

<Where>
<In>
<FieldRef Name='Designation' />
<Values>
 <Value Type='Text'>Engineer</Value>
<Value Type='Text'>Architect</Value>
</Values>
</In>
</Where>


INCLUDES:

MSDN Def: If the specified field is a Lookup field that allows multiple values, specifies that the Value element is included in the list item for the field that is specified by the FieldRef element.

<Where>
<And>
<Eq>
<FieldRef Name=""Specialization""/>
<Value Type=""Lookup"">XML</Value>
</Eq>
<Includes>
<FieldRef Name='Specialization'/>
<Value Type='Lookup'>.Net</Value>
</Includes>
</And>
</Where>

NOTINCLUDES:

It will do opposite to what Includes will do.
In the above list I like to have all the people who are specialized in SQL Server but not specialized in Crystal Report.
Here my SPQuery

<Where>
<And>
<Eq>
<FieldRef Name=""Specialization""/>
<Value Type=""Lookup"">SQL Server</Value>
</Eq>
<NotIncludes>
<FieldRef Name='Specialization'/>
<Value Type='Lookup'>Crystal Report</Value>
</NotIncludes>
</And>
</Where>

between running Full Crawl and Incremental Crawl

Incremental crawl covers the following scenarios, where SharePoint index files will be updated and search results will affected without the need to perform full crawl: Adding new document to document library or new item to list Edit current document content Delete document (incremental crawl will detect the deletion and removes it from the index and from search results). Changing Item permissions. Document properties (columns) Note1: a full crawl should be done at least once before performing incremental crawl. Note2: the above scenarios are covered for crawled content within SharePoint 2010/2013 farm, (not file shares , exchange public folders, custom connectors , etc… for those scenarios incremental crawl behavior might differ).

 Full Crawl includes the following scenarios : If the incremental crawl failed to crawl content for errors , Incremental crawl removes the content from index until next full crawl. When a software update for SharePoint or service pack is installed on servers in the farm, full crawl is required. Add a new mapping for the Managed Metadata property which used as refinements in search results. (e.g. add new filter in search center for documents to refine results by division ). To include document changes on a non SharePoint 2013 sites or older versions of SharePoint, like ASPX pages on Windows SharePoint Services 3.0 or Microsoft Office SharePoint Server 2007 sites. You want to detect security changes that were made on a file share after the last full crawl of the file share. Crawl rules have been added, deleted, or modified which is used to include or exclude sites URLs to be crawled. Creating server name mappings.

Comments

Popular posts from this blog

what is Event Cache table in sharepoint

CAML Query syntax and options in SharePoint

Change anchor link url in sharepoint calender