Wednesday, June 5, 2013

Web Analytic Reports in SharePoint 2013

In SharePoint 2010 we could get Web Analytic reports from the site settings menu, as shown in the screenshot below:
Web-Analytic-Reports-in-SharePoint1.jpg
These reports provides statistics about resources used by the site collection that can be useful for Site Administrators and Operators as in the following:

Web-Analytic-Reports-in-SharePoint2.jpg

In SharePoint 2013 Microsoft has chosen to remove this from the Site Settings menu. And this feature has been deprecated from everywhere it existed. Instead of Analytics Reports we now have Popularity Trends as in the following:

Web-Analytic-Reports-in-SharePoint3.jpg
I have made a note of the URL of the SharePoint 2010 analytics report and simply pasted the "/_layouts/usage.aspx" part in after the SharePoint 2013 site in the URL field. And voila, it works. 

Web-Analytic-Reports-in-SharePoint4.jpg

One thing you need to do is to enable usage of the logging service in your SharePoint farm. Here is a link to do that: http://technet.microsoft.com/en-us/library/ee663480.aspx#section1.

Tuesday, April 30, 2013

PowerView Report Increase font size and change the font

I spent a whole lot of time changing the font inside power view report and was not able to change it.

After googling about Power View Report I came to know that I can not change the font inside a powerview but I can use a theme which has the same font that I wish to change it to. So I changed the theme and able to Modify the font.

After that I tried to increase the text size from 100% to 125% , save the report and close the report. When I reopened it the text size is still 100%. So basically text size isn't getting saved :(. After hit and trial I went to the design tab instead of powerview tab and I found increase text size and decrease font size icon. I increased the font size and saved the report. When I reopened it the change in font size got reflected in the report.

So basically

  • You should change the theme to get desired font.
  • You increase the text size from the design tab.


Monday, April 29, 2013

Exploring Sharepoint 2013

Now a days I am spending a lot of time on learning sharepoint 2013.

I have enrolled myself in pluralsight and it was really a worth decision made by me. I sincerely advise other fellows to please have a look into it as this is the best training site to learn easy way. All the speakers are very much highly excelled in their respective field and they almost update the contents every week so you always be updated with latest technology.

Anyways I am on my way to learning SP2013 and I personally found it really interesting. I will try to post new things here that i am learning each day. 

Monday, April 4, 2011

creating custom code snippets in sharepoint designer 2007

This video describes creating custom code snippets in sharepoint designer 2007 and also give some shortcuts that can be used in designer while creating page layouts from an existing master page.



Intranet developed in sharepoint

I like this video a lot.Here they explain the hudson intranet in details and also it will be useful for u when u r going design a website for ur client giving them the ways to achieve a great design.



Here is another one video infact part-2 of the video series.

Hope u ll enjoy watching the videos.....:)

Wednesday, December 29, 2010

Workflow in Moss 2007-Sending email tips

This is what i learned today about Work flow in Moss 2007.In our project we have a requirement of sending email after a particular step in the work flow.

I tried writing down simple texts and look up in the email body.

To my surprise when the work flow executes and email is send to the assigned person,the mail goes to the junk folder of the mailbox.

But when i use HTML format in the mail body,the mail goes to the desired person mailbox instead of junk folder.So the conclusion is always use HTML format in the body of the email while working with Custom work flow in sharepoint designer 2007.

Saturday, December 25, 2010

How to set Item Level Permission for SharePoint 2007 (MOSS/WSS) List/Document Library Programmatically


Here is a piece of code (a function) to set Item Level Permission. You can use it as a Web Method in a custom Web Service. This method can be used from Applications outside of SharePoint, provided the user using this application has sufficient privilege to update lists/libraries etc.

    public string ItemPermission(string SitePath)
    {
        string ReturnVal = "";
        try
        {
            SPSite WebApp = new SPSite(SitePath);
            SPWeb Site = WebApp.OpenWeb();
            SPList list = Site.Lists["TestDocLib"];
            SPListItem item = list.Items[0];
            SPRoleDefinition RoleDefinition = Site.RoleDefinitions.GetByType(SPRoleType.Contributor);
            SPRoleAssignment RoleAssignment = new SPRoleAssignment("<domain>\\<user>", "email", "name", "notes");
            RoleAssignment.RoleDefinitionBindings.Add(RoleDefinition);
            if(!item.HasUniqueRoleAssignments)
            {
                item.BreakRoleInheritance(true);               
            }
            item.RoleAssignments.Add(RoleAssignment);
            item.Update();
        }
        catch (Exception ex)
        {
            ReturnVal += "Permission not set, reason: " + ex.Message;
        }
        return ReturnVal;
    }




Requirement:

I have a list and have made settings wherein the user can edit only the items created by them and read others data. Now if a person leaves the company all the data created by he/she will become read only to others. There is no apparent OOB way to give permission to any other user to those items at one go. But we can use custom coding and special ability of SharePoint 2007 to set Item level permission for this requirement.

I have created a Custom Web Service to do the trick (From here you will get information about how to implement this web service in SharePoint). And there is a console application to pass the parameters to the Web Service’s web method. You can replace this console app with Windows/Web Form, Web Part etc. Or you can create a custom workflow which will get activated when any user is removed and will call the web service.

Here is the code for the web service:

===================================================  
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using Microsoft.SharePoint;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    public Service () {

        //Uncomment the following line if using designed components
        //InitializeComponent();
    }

    [WebMethod]
    public string ItemPermission(string SitePath, string LibName, string OldUser, string NewUser,string email, string name)
    {

        string ReturnVal = "";

        try
        {
            SPSite WebApp = new SPSite(SitePath);
            SPWeb Site = WebApp.OpenWeb();
            SPList list = Site.Lists[LibName];
            SPQuery newSPQuery = new SPQuery();
            newSPQuery.Query = "<Where><Eq><FieldRef Name=\"Author\"/><Value Type=\"User\">" + OldUser + "</Value></Eq></Where>";
            SPListItemCollection listItemCol = list.GetItems(newSPQuery);
            if (listItemCol.Count > 0)
            {
                foreach (SPListItem item in listItemCol)
                {
                    SPRoleDefinition RoleDefinition = Site.RoleDefinitions.GetByType(SPRoleType.Contributor);
                    SPRoleAssignment RoleAssignment = new SPRoleAssignment(NewUser, email, name, "notes");
                    RoleAssignment.RoleDefinitionBindings.Add(RoleDefinition);
                    if (!item.HasUniqueRoleAssignments)
                    {
                        item.BreakRoleInheritance(true);
                    }
                    item.RoleAssignments.Add(RoleAssignment);
                    item.Update();
                }
            }
        }
        catch (Exception ex)
        {
            ReturnVal += "Permission not set, reason: " + ex.Message;
        }
        return ReturnVal;
    }
   
}
===================================================

Here is the code for console application:

Replace the following things:

<sitepath> with the Full URL of the site
<libname> with the list/library name
<domain> with the domain name
<olduser> with the userid who left the company
<newuser> with the userid to whom you want to give permission
<email of new user> self explaning
<name of new user> self explaning

If "<domain>\\<olduser>" does not work try to use the old user’s full name such as “John Smith”.

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

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        //localhost.Service newService;
        static void Main(string[] args)
        {
            localhost.Service newService = new localhost.Service();
            newService.UseDefaultCredentials = true; //I am assuming an administrator/power user is running this app or use a specific credential here
            string output = newService.ItemPermission("<sitepath>""<libname>""<domain>\\<olduser>""<domain>\\<newuser>""<email of new user>""<name of new user>");
            Console.WriteLine(output);
            Console.ReadLine();
        }
    }
}



Source:msdn