Wednesday, July 18, 2012

The SDDL string contains an invalid sid or a sid that cannot be translated SharePoint 2013



Here is the one more issue with the installation of SharePoint 2013.

The SDDL string contains an invalid sid or a sid that cannot be translated

When you run with sharepoint 2013 installation majorly you will get with 2 issues.

1. Service running under Network Service account in workgroup environment is not supported

Solution for this is explained in the preious post you can find it here

2. The SDDL string contains an invalid sid or a sid that cannot be translated

Solution this is :

To fix this error, login with your Administrator account and create a search service user and add them to the WSS_ADMIN_WPG group.

To do this :

1. Open SharePoint 2013 PowerShell

2. Paste the below code

$SearchServ = Get-Credential [Your Search Account]

New-SPManagedAccount -Credential $SearchServ 


After executing these steps you need to do one more thing.

Go to "C:\Program Files\Microsoft Office Servers\15.0\Data\Office Server" in your server and find the

folder that starts with "Analytics" this looks something like Analytics_GUID

NOTE: If you find multiple Analytics folder choose the latest one.

Right click properties on the folder -> Sharing -> Advanced Sharing

Check the Share this folder check box and leave the name alone and click on permissions..

Here leave the Everyone as Read only ( Default )

Then Add the Search Service Account user you created and give Full Control

Then Add WSS_ADMIN_WPG group and give the Full control for this also.

3. After this try running the configuration wizard it will run seccuesfully..

Njoy SharePoint 2013

Thank you !!

Service running under Network Service account in workgroup environment is not supported SharePoint 2013



Here is the one of the strange issue you will be getting when you install SharePoint 2013 Preview version.

Service running under Network Service account in workgroup environment is not supported

This one is pretty easy to interpret and get around since you really only need to change where AppFabric is running.

So, The resolution for this error is :

1. Open SharePoint PowerShell

2. Navigate to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\BIN

NOTE : SharePoint 2013 is using 15 hive folder in installation ( You have older 14 hive also )

3. psconfig.exe -cmd Configdb create SkipRegisterAsDistributedCacheHost 


Run the above script and you will be proceed with the installation. After this Error fixed you will be come up with the new issue Service running under Network Service account in workgroup environment is not supported This also i have explained in the other post find here

Thank you !!

Install PDF IFilters for Sharepoint ( Not able to search pdf content in search results )

Here is the one more article on SharePoint where i cannot able to retrieve the content of the PDF file in search results.

Please find the below steps to get it done.

1) Install PDF iFilter 9.0 (64 bit) from http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025

2) Download PDF icon picture from Adobe web site http://www.adobe.com/misc/linking.html and copy to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES\

3) Add the following entry in docIcon.xml file, which can be found at: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML within tags

4) Navigate to CA -> Manage Service Application -> Search Service Application, Add pdf file type on the File Type page

5) Open regedit

6) Navigate to the following location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension

Right-click > Click New > Key to create a new key for .pdf

7) Add the following GUID in the default value {E8978DA6-047F-4E3D-9C78-CDBE46041603}

8) Restart the SharePoint Server Search 14

9) Reboot the SharePoint Server

10) Perform FULL crawl to get search results

Thank you !!

sharepoint code to get SPUser from username string

String UserName= “Srikanth Kancharla”;

SPUser User= SPWeb.EnsureUser(UserName);

SPWeb.EnsureUser(): This mehtod will checks whether the specified user name belongs to a valid user of the website, and if the logon name does not already exist, adds it to the website.

Tuesday, July 17, 2012

SharePoint 2013 download

Hi Friends,

As of now we are working with Sharepoint 2010 and it's time to check with SP2013 preview version.

This is the preview version for Sharepoint 2015.

Lot of new features added in this version and also good upgrades are added in Sharepoint 2013

Here you can find the download link for SP 2013 Preview

SharePoint 2013 Preview

Lots of new features added in SP 2013 and also App store is also available in SP 2013

Microsoft Rocks !!!

Monday, July 16, 2012

rename sharepoint farm server

There are some situations where we need to rename the sharepoint server once everything is configured and working.

We have 2 options to do this

1. Using Powershell

2. Using STSADM

STSADM :

1. Go to Computer properties and change the name of the computer

2. Open command prompt and go to 14 hive folder using STSADM utility execute the following command.

stsadm -o renameserver -oldservername -newservername

3. Open central administration from the IIS and change the alternate access mappings of Central admin site and any other existing site ( Change the url from Old Server name to New Server name ).

4. Restart server and check for Central admin site

POWERSHELL :

1. Open Sharepoint powershell command and execute the following command

Rename-SPServer [-Identity] -Name

2. Go to Computer properties and change the name of the computer

3. Open central administration from the IIS and change the alternate access mappings of Central admin site and any other existing site ( Change the url from Old Server name to New Server name ).

4. Restart server and check for central admin site

NOTE : 1. If anything goes wrong with this process after restarting machine please run the Sharepoint wizard once to fix the issues automatically. 2. If you have multiple servers in the farm repeat the same steps for all the other servers.

Thank you !!!

Monday, July 9, 2012

Sharepoint model dialog from ribbon button



Here i am going to explain how to open model dialog box from ribbon button control.

1. Create empty sharepoint project either with sandbox or farm solution.

2. Add feature for the solution and add Empty element file for that as show below :















3. Now your solution will looks something like this.

















4. Add this below given peace of code in Elements.xml file :





  
    
      
        
          
Here you can modify your code and test the application according

As per the testing purpose i am taking Task list template so, this peace of code will work only with Task list template. If you need this for the other templates you need to change the template number

5. Final verification is to check wether the Element file is attached to feature and the feature is added to the solution.

do this verification as below :

a. Double click on .Feature file name and check the referenced ELements file is listed there or not :

















b. Double click on Package and check our package is listed under the packages section.

6. Finally deploy the solution and create a list with Tasks template and click on Items tab, There you will find the new button "Open model popup"

















7. Click on that button you will get Settings.aspx model popup page.

















Here for demo purpose i am using default settings page. In real time you can change this on fly.

Thank you !!!



Enable inline editing in sharepoint list

Sharepoint 2010 has one more beatiful feature which is JSGrid implmenetation in sharepoint list view thais is called Inline editing.

For any sharepoint list we can enable Inline editing at view level.

1. Open your sharepoint list

2. In Ribbon click on List -> Modify this view

3. In the options expand Inline editing and check Allow inline editing check box.

Here is the output

















Thank you !!!



Friday, July 6, 2012

Running a SQL Stored Procedure from Excel with Dynamic Parameters

Here is the interesting article about how to generate report from stored procedure to Excel sheet.

This is called as Pivot reports.

Here we can also call the stored procedures with input parameters.

Below are the step by step process to do the same :

1. Open Excel ( Start -> Excel )

2. In Tabs Click on Data -> Connections


















3. In Workbook Connections wizard click on Add and select your database server/ Instance name and Add that to workbook and then close the wizard.

<< So far we are done to make the connection with the DB server >>

4. After this again in the Data tab From other sources and select From microsoft query.

















5. In choose data sources wizard select the appropriate database name and click on OK.

















6. This will open up a Query wizard to select the parameters.

7. Here select any of the dummy parameters from the existing values ( we dont use this in future but select a dummy values ) and then click on Next button

















8. Query Wizard Filter data -> click Next

9. Query Wizard Sort Order -> click Next

10. Query Wizard Finish -> select "View data or edit query in microsoft query" -> click on Finish

















11. In Microsoft query window click on SQL button on Top as show in the below screen shot.

















12. In the SQL Statement window place your Stored Procedure with dummy parameter what ever you want ( This we can configure it later as dyncamic )

















13. Then click on OK. This will prompt you with warning message saying "SQL query cannt be represented graphically" ignore this warning continue anyway and close the wizard window.

14. Then it will open Import data wizard.

















15. Click on Properties -> in connection properties windows select Definitions tab.

16. Here in CommandText section you will find your query with the dummy parameter. Here replace the parameter with ?

















17. Click OK and close the wizard window.

18. After this excel sheet will prompt you for the input. Provide the input and click on OK, Here is the result

















NOTE :

1. Inputs can be configured from the Excel sheet cell also.

2. Reports can be converted in to graphics also

3. Reports can be configured as auto refresh on periodic basis.



Thank you !!!



key filters sharepoint

Sharepoint 2010 has lot of OOTB features added without writing single line of code.

One of them is Key filtering for sharepoint list.

This is one of the beauty of sharepoint due to its efficiency and look and feel.

Please follow the steps below to enable the Key filterings.

1. Open sharepoint list

2. Click on List in Ribbon control.

3. Click on List settings

4. Go to metadata navigation settings

5. In this page you can select what are the fields required for the filtering. Here i am selecting 3 columns on Configure key filters section and click OK.

















6. Go back to list, Here you will get your key filters at left navigation side.

















NOTE : Event though it is very powerful it has its own pros and cons those are listed below.

Pros :

1. Very efficient as it is xml based at back end.

2. Easy to create and configure.

3. No coding is required.

Cons :

1. It will work only on list forms ( if you add the same list to any of the site pages this key filters will not work there )

2. It is difficult to package this key filters ( some coding is required to enable this feature at the time of deployment )

Thank you !!



enable developer dashboard sharepoint 2010

Usually when we are developing sharepoint application some times we found that page is taking lot of time to load the content.

In this kind of scinarios we need to figure out on which web part where it is taking long time to get the data to fix the performance issues.

Here sharepoipnt provided a good feature to calculate this kind of information called Developer dashboard.

steps to do this :

1. Enable developer dashboard through powershell

2. select developer dashboard and analyze your page health report.

Here is the Powershell script :

Dashboard : On

$service = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$addsetting =$service.DeveloperDashboardSettings
$addsetting.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On
$addsetting.Update()


Dashboard : Off

$service = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$addsetting =$service.DeveloperDashboardSettings
$addsetting.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::Off
$addsetting.Update()


After this you can just go to your site home page or any other site pages. Here you will find a new image icon just beside the login account name control like

















Click on that then you will get the complete report of the page like

1. how much time it is taking for each web part.

2. Stored procedures executing time.

3. Events load time etc..

















Thank you !!



sharepoint powershell missing shortcut

This is the one more issue when we work with sharepoint powershell.

Issue : When you run sharepoint powershell command for the first time. Some times you will get an error saying that "Missing shortcut".

Here is the screenshot of the same :

















Resolution :

1. Start -> Microsoft sharepoint 2010 products -> Sharepoint 2010 management shell.

2. Right click on this go to properties.

3. In Shortcuts tab change the Target value to %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit add-pssnapin microsoft.sharepoint.powershell

















<< This required admin control on the server >>

<< Adding this snap-in you can do manually by running windows powershell also >>

4. Save and close the wizard.

Now Open your Sharepoint powershell will works fine.

Thank you !!



Tuesday, July 3, 2012

property bag in sharepoint 2010

Sharepoint Property bags :

This is one of the good feature in sharepoint. This feature is already there in MOSS 2007 and it is carried to the latest version Sharepoint 2010 also.

This is basically used to store the key and value pair in hashtable format.

This is something like app.config information in classic ASP.NET.

Property bags can be created / Modified / Deleted from sharepoint designer or using Object model.

Using sharepoint designer :

1. Open a site in SharePoint Designer

2. Go to Site menu click on Site options

3. Site Settings dialog box opens

4. Click on Parameters tab where you can see the list of existing properties

from the same place you can even perform add/modify/delete operations.

















Using sharepoint object model :

using (SPSite RootSite = new SPSite(URL))
            {
                using (SPWeb web= RootSite.OpenWeb())
                {                    
                    try
                    {
                        web.AllowUnsafeUpdates = true;
                       // Get Property bag
                        if (web.AllProperties.ContainsKey("SiteID"))
                        {
                            var data = web.AllProperties["SiteID"].ToString();
                        }                        
                        // Set Property bag
                        web.Properties["SiteID"] = "GUID";
                        web.Properties.Update();
                        web.AllowUnsafeUpdates = false;                        
                    }
                    catch (Exception ex) 
                    { 
                      //Throw Exception  
                    }           
                }
            }


NOTE : Property bags can be handled @Farm level, @Web application level, @Site level.

Thank you !!!



sharepoint powershell run timer job

In sharepoint deployment automation is the one of the key parts of development.

One of the key features of sharepoint is to create timer job which will execute a process at regular intervals of time.

Here comes the interesting part is to automate the timer job deployment.

There are 2 options for that.

1. Using Sharepoint object model which we will execute from the Feature activation.

2. Using powershell script which we can put as deployment files.

Here is the peace of code.

$WebApp = Get-SPWebApplication http://siteurl
$job = Get-SPTimerJob | ?{$_.Name -match $JobName} | ?{$_.Parent -eq $WebApp}



Thank you !!



Monday, July 2, 2012

sharepoint event handler redirect page

Here is the one more requirement to redirect user from event handler.

You can redirect user to a custom message page with code.

Here is the code for that.


/// 
       /// An item is being added.
       /// 
        public override void ItemAdding(SPItemEventProperties properties)
        {
            base.ItemAdding(properties);
            
            // Any condition 
            if (properties.ListItem["Manager"] != SPContext.Current.Web.CurrentUser.LoginName)
            {
            
                // Set the status property to CancelWithRedirectUrl this tells the event handler to cancel the operation
                properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
                
                // Get the application page generic with SPUtility 
                properties.RedirectUrl = SPUtility.GetGenericSetupPath("/MyProj/MyPage.aspx");

            }
        }




Thank you !!!



sharepoint programmatically change master page

This article i will give you the peace of code where we can change the sharepoint master page programatically.

Here is the code snippet for the same.

 SPSecurity.RunWithElevatedPrivileges(delegate()
                   {
                       using (SPSite site = properties.Feature.Parent as SPSite)
                       {
                           using (SPWeb web = site.OpenWeb())
                           {
                               //Logging feature activation status in list
                               web.AllowUnsafeUpdates = true;

                               //Changing the master page
                               web.CustomMasterUrl = "/commerce/Custom/_catalogs/masterpage/Custom.master";
                               web.MasterUrl = "/commerce/Custom/_catalogs/masterpage/Custom.master";

                               //Setting the Navigation propertiers for web
                               web.AllProperties["__IncludeSubSitesInNavigation"] = "False";
                               web.AllProperties["__IncludePagesInNavigation"] = "True";

                               web.Update();
                            }
                         }
                      }     


web.AllProperties methods will change the navigation source for the web application, This you can change according to business need.

Thank you !!



sharepoint designer access denied

Here is an interesting error you will get some times while working with Sharepoint designer i.e "Access denied"

Solution :

If you get this error make sure the attempted login user is a site collection if not add as site collection administrator.

Hope this will help !!!