Wednesday, July 18, 2012

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 !!