Showing posts with label SP2010. Show all posts
Showing posts with label SP2010. Show all posts

Sunday, August 25, 2013

Can't get SPContext inside Event Receiver

Just recently came to know about this, thought I might share my learning. It is basically by design that you cannot get the SPContext inside the event handlers. This might leave you wondering then how should you proceed? 

Well, you can of course use event properties passed as argument to the handler to get reference to current web, site, or the list item, etc.

Example below:

public override void FeatureActivated(SPFeatureReceiverProperties properties)

SPWeb web = properties.Feature.Parent as SPWeb;
//Some code with web 
}


Wednesday, May 15, 2013

Add Custom CSS to your SharePoint MasterPage



As often it happens, we have to customize the look-n-feel of the v4.master to achieve the styles as expected by customer. At this point, we end up designing a custom CSS and then associate it within the MasterPage. The steps for doing that are explained below:


  • Use an SP2010 control called cssregistration and add a line below the existing csslink:
  • Existing line: runat="server" Version="4" />
  • Now, add the above mentioned control by putting the line: ="server" name="/Style%20Library/Scripts/style.css" After="coreV4.css" />

What this does is basically it tells the SharePoint to load your custom CSS after the load of the default Corev4.css. This way your styles will supersede the default styles.

Saturday, May 11, 2013

Fix the Max Controls Issue in SharePoint

While working with SharePoint MasterPages, sometimes, you might see this peculiar issue, "This page allows a limit of 200 controls, and that limit has been exceeded" and ponder over what could have caused it.

The real source for this exception to be thrown is in the web.config file,

MaxControls
="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false" />

So, this is about the limit that Microsoft has typically placed in a SharePoint Web Application's web.config, the SafeMode section has a MaxControls attribute that's set to 200 by default.

Going past this threshold limit may cause stability issues for the page. This could have been caused accidentally while you were adding some custom controls on the Masterpage.

To fix this, do not try to edit the web.config Max Controls setting to a higher number as that is not recommended although for smaller enterprises it might be permissible. However, at large corporations, this would not be allowed by their IT department.

Rather, you should take out a few controls from the MasterPage by editing it in the SharePoint Designer (SPD) and do an IISReset, your page starts working again. This should save your day again.. :)

Friday, May 10, 2013

Steps to consume Aspose Cells license in Code

Recently, I got the chance to use Aspose.Cells in one of my project. Once, you have procured the Product license key which is typically in a .txt file, you can register the license in 4 simple steps:

  1. Get rid of any reference to the evaluation period version of the DLL (if used) from your solution
  2. Add a folder in the VS2010 Solution and just add a folder and place the required license file (Aspose.Cells.Lic)
  3. Make the client license as a part of the VS2010 solution by going to the license property in Visual Studio and choosing In the Properties dialog box, locate the Build Action property. By default, this property is set to Content. Click the property and change the Build Action property to Embedded Resource
  4. Before starting the use of the available tool in the visual studio webpart, you need to write the below code atleast once in the code and refer to the correct DLL. 
  5. This method can be called on the Page_Load of the Visual Webpart code behind (.cs) file. For more details, use the below mentioned URL to the Aspose team: 
  6. http://www.aspose.com/docs/display/cellsnet/Licensing
  7. //Instantiate the License class
    Aspose.Cells.License license = new Aspose.Cells.License();
    
    //Pass only the name of the license file embedded in the assembly
    license.SetLicense("Aspose.Cells.lic");
    
    



Thursday, October 13, 2011

Planning to write MS Certification 70-576

Designing and Developing Microsoft SharePoint 2010 Applications

It has been quite sometime since I last wrote any MS certification. I am planning to write the 70-576 on the latest SP 2010 soon. Lets see how it goes..

Some helpful items could be found at the below links for preparations:

http://channel9.msdn.com/learn/courses/SharePoint2010Developer/

http://joelblogs.co.uk/2010/09/01/top-tips-for-passing-sharepoint-exams-70-667-70-668-70-573-and-70-576/

Bye, I gtg now..studies ;)

Thursday, September 22, 2011

SharePoint 2010 SP1 released and Office Sept CU available

SharePoint 2010 SP1 was released on 28th June 2011 and it is available for download


It is important to have your systems updated with the latest service packs and subsequently with the cumulative updates (CU) which MS typically releases each month.


Some important points to note before going ahead with the installation: 

  1. Do read the known issues published on the TechNet: http://support.microsoft.com/kb/2532126 
  2. Be aware about the order to follow in case of these updates: 
    • Update SharePoint Foundation first with SP1 and then install the CU 
    • Then SharePoint Server with SP1 and then install June CU 
  3. If you have a farm installation, then run “psconfig –cmd upgrade –inplace b2b -wait” on every server in the farm following the final update installed else run the same command on your standalone box
  4. To verify if the updates have been installed properly, check the Central Administration à System Settings à Manage Servers In Farm
    Or, in PowerShell, write (get-spfarm).buildversion
It should display 14.0.6029.1000 after SharePoint Server 2010 SP1. Hope this helps folks trying to keep their SP2010 boxes up-to-date.

For any other assistance, go through SharePoint 2010 Team Blog here

Fix Configuration of the Document ID feature

With SP2010, Microsoft has tried to provide an excellent and helpful feature for uniquely identifying a document within a site collection called DocumentID.
Well, you might ask the rationale behind this tiny change from MS side..right?

Basically, with the previous version of SharePoint product i.e. MOSS 2007, if the user moved a document within a site collection, lets say from one document library to another or the folder containing the file has been renamed or your site URL has been modified in someway, then you would typically face a situation which in IT is called a Broken Link or simply put a bad url :(.

Hence, in the site collection features, you would typically get an option to activate/deactivate the Document ID Service

Document ID Service
Once you have this activated, you would expect the Document ID column to show up when you try to add a new document to a library, unfortunately there is another catch here. You might see this message, "Configuration of the Document ID feature is scheduled to be completed by an automated process." as highlighted in the image below:


This message is shown because the timer job called Document ID enable/disable job has been activated. Once the job completes at the scheduled time, the message will go away or else you may run the timer job and put it to completion forcibly by clicking "Run Now". However, I can assure you that even after the previous step, there is no certain time when the Document ID would show up if you go for a new document upload.

Document ID enable/disable Job


One v.important note that if your doc lib was already having some documents, you would need to explicitly perform some action for this new column of Document ID to show up..for example Check-in/Check-out of docs.

Do try this out and explore this cool stuff from SharePoint 2010!

LinkWithin

Related Posts with Thumbnails