Sharepoint Tips

 https://sharepoint-sandbox.com/

 

Tip #1: How to control "Access Denied" page

The SPUtility.HandleAccessDenied method provides the functionality to redirect users to the standard "Access Denied Page" pragmatically, thus asking them to re-logon. One of the scenarios of such usage is the public sites, where access to the standard SharePoint specific pages still exists and you want to block those pages (source)

However, you can handle access denied exception via SPSecurity.CatchAccessDeniedException = true

Access deined exception is handled by sharepoint platform and user will be redirected to _layouts/AccessDenied.aspx page if user doesnt have permission to perform that task. This might casue usability problem in some cases. You can handle access denied exception in your code by setting CatchAccessDeniedException value to true.
Following code snippet shows how to handle access denied exception:

bool catchException = SPSecurity.CatchAccessDeniedException;
SPSecurity.CatchAccessDeniedException = false;
try
{
//updating list item
SPList list = SPcontext.Current.Web.List["TestList"];
SPListItem item = list.Items[0];
item["title"] = "Some value";
//If user doesnt have permission, exception will be thrown
//If value of CatchAccessDeniedException is true, then user will be
//redirected to AccessDenied.aspx page
item.Update();
}
cach(Exception ex)
{
//Your custom error message can be shown here
}
finally
{
//reset the flag to original value
SPSecurity.CatchAccessDeniedException = catchException;
}

 

Sharepoint Tips

start learning Sharepoint 2010 from the video demonstrations given by microsoft experts at

https://www.bing.com/videos/browse/more?q=browse:more/Related%20Videos&query=%3CvideoQuery%3E%3CvideoFilter%3E%3Ctype%3ERelated%3C/type%3E%3Csource%3EMsn%3C/source%3E%3CsafetyFilter%3EStrict%3C/safetyFilter%3E%3CrelatedAlgorithm%3E1%3C/relatedAlgorithm%3E%3Cuuids%3E%3Cuuid%3Eadc12310-ad50-4ffa-9cc5-c104596849ee%3C/uuid%3E%3C/uuids%3E%3C/videoFilter%3E%3CvideoSort%3E%3CsortField%3EDate%3C/sortField%3E%3CsortDirection%3EDescending%3C/sortDirection%3E%3C/videoSort%3E%3C/videoQuery%3E&title=Related%20Videos

 =================================

 

Configuring MOSS2007 Usage Reports

 
Three Quick Steps to Configure Site Usage Reporting

Enable Usage Logging in Central Administration
A. On the Central Administration home page, click Operations.
B. On the Operations page, in the Logging and Reporting section, click Usage analysis processing.
C. On the Usage Analysis Processing page, in the Logging Settings section, select Enable logging.
D. Type a log file location and number of log files to create.
E. In the Processing Settings section, select Enable usage analysis processing, and then select a time to run usage processing.

Enable Usage Reporting on SSP Admin Page
A. On the SSP home page, in the Portal Usage Reporting section, click Usage reporting.
B. On the Configure Advanced Usage Analysis Processing page, in the Processing Settings section, click Enable advanced usage analysis processing.
C. In the Search Query Logging section, select Enable search query logging.

Activate the Reporting Feature for the Site Collection
A. On the Site Actions menu, click Site Settings.
B. On the Site Settings page, in the Site Collection Administration section, click Site collection features.
C. On the Site Collection Features page, click the Activate button for the Reporting feature.

======================================

 

A content type is a reusable collection of metadata (columns), workflow, behavior, and other settings for a category of items or documents in a Microsoft SharePoint Foundation 2010 list or document library. Content types enable you to manage the settings for a category of information in a centralized, reusable way.

For example, imagine a business situation in which you have three different types of documents: expense reports, purchase orders, and invoices. All three types of documents have some characteristics in common; for one thing, they are all financial documents and contain data with values in currency. Yet each type of document has its own data requirements, its own document template, and its own workflow. One solution to this business problem is to create four content types. The first content type, Financial Document, could encapsulate data requirements common to all financial documents in the organization. The remaining three, Expense Report, Purchase Order, and Invoice, could inherit common elements from Financial Document and also define characteristics unique to each type, such as a particular set of metadata, a document template to be used in creating a new item, and a specific workflow for processing an item.

 

https://blogs.msdn.com/b/martinkearn/archive/2006/03/27/561809.aspx?PageIndex=1

https://msdn.microsoft.com/en-us/library/ms472236.aspx

 

==============================================================================

How to implement SSL in IIS

https://support.microsoft.com/kb/299875

 

==============================================================================

 

https://msmvps.com/blogs/laflour/archive/tags/SharePoint+Tips+and+Tricks/default.aspx

 

=============================================================================

Making the content query web part deployable

 
My biggest issue with the CQWP? its not deployable when connected to a specific list in a specific site.
If you configure a CQWP web part to connect to a list in a site, the web part saves the ID (GUID) of the list - and if you want to deploy the web part as part of a feature or onet.xml so that the web part gets added every time a user creates a site, it will fail - because the ID of the list changes every time you create a new site.
My solution? override the web part and implement the following 2 functions:
public class MyBetterQueryWebPart: ContentByQueryWebPart
{
public void SetListGuid()
{
if (!string.IsNullOrEmpty(this.WebUrl) &&
!string.IsNullOrEmpty(this.ListName))
{
using (SPWeb web = SPContext.Current.Site.OpenWeb(this.WebUrl, true))
{
SPList list = web.Lists[this.ListName];
this.ListGuid = list.ID.ToString();

}
}

}
protected override void OnLoad(EventArgs e)
{
if (!string.IsNullOrEmpty(this.WebUrl) &&
!string.IsNullOrEmpty(this.ListName) &&
string.IsNullOrEmpty(this.ListGuid))
{
SetListGuid();
}
base.OnLoad(e);
}
}
This code checks if the web part is in list mode (has a list name and a web url) and is "corrupt" - doesnt have a list ID. if it finds that is the case, it dynamically loads the list ID based on the site url and the list name.

 

 

 

 

Search site

© 2010 All rights reserved.