posts - 41, comments - 200, trackbacks - 0

My Links

News

These postings are provided "AS IS" with no warranties, and confers no rights.
Locations of visitors to this page virtusa corp sharepoint virtusa.com shehan peruma

Tag Cloud

Archives

Post Categories

Friday, October 14, 2011

Tools to improve sites performance

Came across this pretty big listing of tools that help improve a sites performance: http://code.google.com/speed/tools.html

Home page: http://code.google.com/speed

 

And an article from Google: http://googlewebmastercentral.blogspot.com/2010/04/using-site-speed-in-web-search-ranking.html

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Friday, October 14, 2011 2:38 AM | Feedback (0) | Filed Under [ Tools ]

Tuesday, September 27, 2011

Unable to start SQL Server service

 

When I try to start the service, it fails and the following appears in the Application log within Event Viewer:

Source:        MSSQL$SQLEXPRESS
Event ID:      17058
Task Category: Server
Level:         Error
Keywords:      Classic
User:          N/A
Description:
initerrlog: Could not open error log file ''. Operating system error = 3(The system cannot find the path specified.).

To fix this I had to change the Log on as property of the service from Local Service to Local System

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, September 27, 2011 6:20 AM | Feedback (0) |

Thursday, September 01, 2011

Google Feeds API

I was given with a simple requirement – create an online component that has the ability to pull RSS feeds asynchronously from websites.

I could have written a server control, but that would mean I would need to write the logic to read the xml and parse it. Totally doable, but it was late in the day when the requirement came in and I wasn’t about to slave over Visual Studio to write manage code. Smile OK, so long story short I used the Google Feed API to get the job done.

Assuming you know jQuery the code is pretty straightforward. I haven’t included any styling or any other scripts.

   1:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   2:  <html xmlns="http://www.w3.org/1999/xhtml">
   3:      <head>
   4:          <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
   5:          <title>Google Feed API Sample</title>
   6:      </head>
   7:      <body >
   8:          <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>
   9:          <script src="http://www.google.com/jsapi?key=AIzaSyA5m1Nc8ws2BbmPRwKu5gFradvD_hgq6G0" type="text/javascript"></script>
  10:          <script type="text/javascript">
  11:          /* http://code.google.com/apis/ajaxfeeds/documentation/reference.html#JSON */
  12:              
  13:              /*Array to hold the various feeds.*/
  14:              var myfeeds = new Array();
  15:              myfeeds[0] = new Feed("Facebook","https://www.facebook.com/feeds/page.php?id=85647828805&format=rss20",5);
  16:              myfeeds[1] = new Feed("Twitter","https://api.twitter.com/1/statuses/user_timeline/VirtusaCorp.rss",10);
  17:              myfeeds[2] = new Feed("Yahoo","http://feeds.finance.yahoo.com/rss/2.0/headline?s=VRTU&region=US&lang=en-US",2);
  18:              myfeeds[3] = new Feed("Nasdaq","http://articlefeeds.nasdaq.com/nasdaq/symbols?symbol=VRTU",10);
  19:   
  20:              /* Creates a Feed object */
  21:              /* name - Name of the feed. Will show-up as the button text */
  22:              /* uri - The location of the feed */
  23:              /* count - Number of items to be shown for the feed */
  24:              function Feed(name,uri,count)
  25:              {
  26:                  this.name=name;
  27:                  this.uri=uri;
  28:                  this.count=count;
  29:              }
  30:   
  31:              google.load("feeds", "1");
  32:   
  33:              /* Callback function when feed is loaded */
  34:              function feedLoaded(result)
  35:              {
  36:                  if (!result.error)
  37:                  {
  38:                      $("div#content").empty();
  39:                      $("div#content").append("<ul></ul>");
  40:                      /* iterates through the results and renders them on the page */
  41:                      for (var i = 0; i < result.feed.entries.length; i++)
  42:                      {
  43:                          var entry = result.feed.entries[i];
  44:                          if (entry.title != '')
  45:                              $("div#content ul").append("<li><a href='"+entry.link+"' target='_blank'>"+entry.title+"</a></li>");
  46:                      }
  47:                  }
  48:              }
  49:   
  50:              /* Click event for the feed buttons. Calls the Google API to load the feeds */
  51:              function LoadFeed(uri,count)
  52:              {
  53:                  $("div#content").empty();
  54:                  $("div#content").append("<p>Loading...</p>");        
  55:                  var feed = new google.feeds.Feed(uri);
  56:                  feed.setNumEntries(count);
  57:                  feed.setResultFormat(google.feeds.Feed.JSON_FORMAT);        
  58:                  feed.load(feedLoaded);
  59:              }
  60:              
  61:              /* Dynamically creates and renders the feed buttons based on the contents of the myfeeds array  */
  62:              function RenderButtons()
  63:              {            
  64:                  for (var i in myfeeds)
  65:                  {
  66:                      var markup = "<button type='button' onclick=\"javascript:LoadFeed('"+myfeeds[i].uri+"',"+myfeeds[i].count+");\">"+myfeeds[i].name+"</button>"
  67:                      $("div#buttons").append(markup);                    
  68:                  }
  69:              }
  70:              
  71:          </script>
  72:   
  73:          <div id="buttons"></div>
  74:          <div id="content"></div>
  75:          
  76:          <script>
  77:              RenderButtons();
  78:          </script>
  79:      </body>
  80:  </html>

 

Make sure you obtain an API key that is specific to your site to use in line #9. More info here.

All you need to do is update the myfeeds array with the list of your RSS feeds and the script will do the rest.

Have fun!

p.s. in the above sample, you might notice that I have all the script code within the <body> tag. I purposely did this so I would only have to copy the code within it an paste into a CEWP if I needed to use it in SharePoint.

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Thursday, September 01, 2011 5:31 PM | Feedback (0) |

Wednesday, August 24, 2011

Latest jQuery library

Use the following link to find out the latest version of the jQuery API library hosted on Google’s CDN: http://code.google.com/apis/libraries/devguide.html#jquery

 

Technorati Tags:
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Wednesday, August 24, 2011 12:59 PM | Feedback (0) |

Tuesday, December 07, 2010

Prevent anonymous access to form and application pages in SharePoint 2010

 

When you create a Publishing site that has anonymous access enabled, you will notice that anonymous users will not be able to access pages that reside in the “_layouts” virtual directory (e.g. http://siteX/_layouts/viewlsts.aspx). This is because the publishing infrastructure activates a hidden feature that prevents anonymous users from accessing these types of pages. However, if you were to create a site collection based of  Blank Site Template, you would notice that these pages are accessible by anonymous users.

The fix is quite simple. There is a hidden feature that you would need to manually activate via stsadm. The feature is called “ViewFormPagesLockDown” (and is available in the Features folders in the 14 hive)

To activate it:

stsadm -o activatefeature -filename ViewFormPagesLockDown\feature.xml -url http://ServerName

Once activated anonymous users will be promoted to enter credentials when they try to access form and application pages.

The feature can also be deactivated for publishing sites that have it automatically turned on.

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, December 07, 2010 5:46 AM | Feedback (1) |

Wednesday, December 01, 2010

Creating an anonymous site in SharePoint 2010

 

Here’s how:

  1. Open up the Central Administration site and click on “Manage Web Applications” under the “Application Management” section
  2. From the ribbon click on “New” (Note: if its an existing web app, then click on “Extend”)
  3. Fill in the fields with appropriate values. Under “Security Configurations” make sure to select “Yes” for “Allow Anonymous”
  4. Click OK
  5. Once the web application has been created, a site collection would need to be created. Navigate to “Application Management” –> “Create Site Collection”
  6. Fill in the fields with the appropriate values and create the site collection
  7. Next sign into the newly created site collection as the Site Collection Administrator.
  8. From the “Site Actions” menu, select “Site Permissions”
  9. In the permissions page that loads, click on the Anonymous Access button appearing on the ribbon.
  10. A modal dialog would popup. Select the appropriate option and click OK.
  11. If you selected “Entire Web Site” its advisable to restart the browser to test anonymous access
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Wednesday, December 01, 2010 5:05 AM | Feedback (1) |

Tuesday, November 16, 2010

Error creating SharePoint project in Visual Studio

 

The following issue was encountered on a developers machine when trying to create a SharePoint project using Visual Studio 2010.

From the File menu the developer selected New->Project and then selected ‘Empty sharepoint project’ (SharePoint 2010) and then typed in the url into the dialog box that appeared and then hit the Validate button. Upon clicking the button, the following error message was shown:

Cannot connect to the SharePoint site: http://serverX:6666/. Make sure that the Site URL is valid, that the SharePoint site is running on the local computer, and that the current user has the necessary permissions to access the site.

To fix this error:

  • Open up SQL Manager and navigate to Security –> Logins
  • Select the user that you’re using to create the VS project (if the user is not there, add it)
  • Under Server Roles for the user tick sysadmin

Now it will be possible to create the SP project with getting the error.

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, November 16, 2010 12:24 PM | Feedback (4) |

Monday, October 18, 2010

command to list all files in a folder structure recursively

 

dir /a-d /b /s

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Monday, October 18, 2010 5:28 PM | Feedback (0) |

Thursday, October 14, 2010

Refinement Panel raw xml

 

If you want to see the RAW xml returned by the Refinement Panel web part then replace the existing XSL with the following (do remember to backup the original):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xmp><xsl:copy-of select="*"/></xmp>
</xsl:template>
</xsl:stylesheet>

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Thursday, October 14, 2010 4:24 AM | Feedback (2) |

Friday, October 01, 2010

Staring a workflow inside a list event receiver sends out a wrong link

 

Here’s the scenario:

The user navigates to the NewForm.aspx page of a list and enters values into the necessary fields. As soon as the user click the OK button the browser should take the user to the EditForm.aspx page and load the previously entered item in edit mode and also start the approval workflow on the item.

 

Solution:

Create a event receiver for the list that hooks up to the ItemAdding event. There are quite a few blog posts out there that talk about this, so instead of typing down the same you can check them out for yourself here and here (note: do read the comments too as there some useful tips in there as well).

Following the same/similar approach would help you meet your requirements. For the workflow bit; after adding the item use the sites workflow manager object to kick start the workflows associated with the list (see here for sample). Add yes that works. But here’s where the problem is, in my scenario the site from which users will interact with the list is an extended site that’s in the Internet zone and uses FBA authentication. The original web application uses NTLM and (obviously) has a different URL (host header). So when the workflow mail arrives it has the urls for the NTLM site.

To overcome this you would need to obtain a copy of the SPContext.Current object into a variable in the constructor of the event receiver (much like how you’re capturing the httpcontext object mentioned in the blog posts links above), then utilize this to retrieve the SPSite and SPWeb objects inside of the ItemAdding event handler instead of going through the properties (SPItemEventProperties) parameter.

By doing the above SharePoint knows which context to use when performing its operations and then adds the correct url to the workflow emails.

 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Friday, October 01, 2010 6:04 PM | Feedback (0) |

Powered by: