Showing posts with label SharePoint 2013. Show all posts
Showing posts with label SharePoint 2013. Show all posts

Thursday, December 19, 2013

CAML Designer for SharePoint 2013

If you've been using U2U CAML query builder for SharePoint 2003, MOSS 2010 and SharePoint 2010, you must be looking for the same builder also for SharePoint 2013.

Here is a great new CAML builder with lot of new features as well as some ready snippets for server side object model, client side object model and JavaScript object model as well.

Check the below link.

CAML Designer 2013

I hope this will help.

Friday, December 13, 2013

ExecuteOrDelayUntilScriptLoaded not executing

If at any point of time you are using ExecuteOrDelayUntilScriptLoaded in a page or specifically in a publishing page and finding it not working, there is a strong chance that you need to replace this function with other function called SP.SOD.executeFunc.

In SharePoint 2013, the correct way to execute function after script is loaded is to use SP.SOD class and not ExecuteOrDelayUntilScriptLoaded.

If its ExecuteOrDelayUntilScriptLoaded({functionname}, "sp.js");

then replace it with

SP.SOD.executeFunc('sp.js', 'SP.ClientContext', {functionname});

This will also come handy specially when a user who has read / view only access the site where sp.js refuses to load when ExecuteOrDelayUntilScriptLoaded is used.

Sunday, September 1, 2013

Promoted Links in SharePoint 2013

In this post we are going to see one of the new features in SP 2013 which is promoted links. Promoted links are new concept through which you can promote your links on various pages. The classic example would be the one that you see default on the page like below.



When you hover over a image it shows you a nice animation and description about that image - link. When you click on that link it takes you to the page where URL is defined where to navigate.



You do not need to anything special here to have that mouse hover effect. SP 2013 now comes with a brand new template called promoted links as a list template.

So let us create one list with the template promoted links and see what all fields are available which makes promoted links one of the cool features.

Click on add an app from gear icon. Remember now every list and library is called app in SP 2013 love it or not.

You will find promoted links template. Click on the template to create one.



Give name.



You will find two views created default. One where you can see a list with fields and values and other as a actual tile interface which looks like the first image which we have in this post.



As you can see you have various options to set. You can also set the launch behaviour while creating list item. I have it for Bing, Google and for Yahoo. After adding values into the list items and going to the tiles page give us a look like what we wanted.




As you can see you do not have to do any other settings. All the effect like displaying text in animated format when you hover the mouse is taken care by SharePoint itself.

I hope this helps. 

Thursday, August 15, 2013

Get Installed languages in SharePoint

In this post we are going to see how we can get all the installed languages for the site in SharePoint. This is especially useful when you have various language packs installed in the site.

I am going to create a simple console application. The code will also runs the same in SharePoint WSP solutions as well.

Here is a simple code in console application and the result when you run that.




If in your language settings you only have English selected, you would get only one language. so Its not about how many languages are available, it's about how many languages you have selected and allowed to be selected by user from the menu option.

I also would like to show you how you can get the same using PowerShell.

Open up SharePoint management shell and write down these steps. You are good to go.



I hope this helps.

Tuesday, August 13, 2013

Managed Metadata for localization

In this post we are going to see how managed metadata term store can be useful while considering localization in the form of values shown in the list and library item if the field type is of managed metadata.

To see this first we are going to create a managed term store data in English and then we are going to create the same term values in Spanish values.

open up your site and go to site settings and locate term store management under site administration.

Best way to test this is import the sample file that comes default.

Click on managed metadata and then click on new group. and give name CountryTS



Keep English as the selected language from language option in menu Now click on the CountryTS group and click on add term set give name Countries. Click on countries and click on add new term and add these three countries.



Now Change the language to Spanish



To test we will just change the text and add Spanish at the end. So after changing it would look something like this.



Now in any of the list go to the list settings. Click on create column and add the field with the name countries. Type should be managed metadata and then select countries from the term store list.



Add couple of entires.



Now it should be like this



Now change the language from English to Spanish



and see the result



As you can see that it automatically changes the text based on the language selected from menu and it automatically pick up corresponding values from term store.


I hope this helps.

Friday, August 9, 2013

Localize site columns, features and web parts

In this post we are going to see how we can localize site columns as well as features.
First let us focus on the site columns.

Create empty SharePoint project.



Now right click on project and click on add mapped folder and add resource folder.



Now again click on add new item by right clicking on resource folder and select resource file.



Add these two values



Now add one more resource file for Spanish language. add es-es to the file name as shown in the image below and add below entries.



Now it's time to create empty element where we would be adding the site columns.
Right click on project and add empty element.

Add this to the empty element.



Build and deploy the solution

One thing to consider here is that you need to have language packs installed on the server.
Go to the site settings and site columns. Right now we are with English language.



Change the language to Spanish



As you can see that column title gets converted to the Spanish language.

We already have a feature with us which has site columns element file. Our sole purpose is just to show how features can also be localized. Now right click the feature and click on add feature resource.



Select Spanish from long list of languages.

And add these texts



and then add this to the web part properties



When you have set the language to English, this is what you get



Switch language to Spanish.



Let us add one web part. After that open the same LocalizedSiteColumn.resx under resource folder and add this.



now open the Spanish resource file and add this



Now open the web part file and change the title and description to point it to resource file.

This will also localize the web parts. I hope this helps.

Friday, April 19, 2013

Create document set programmatically


In this post we are going to see how to create a document set in SharePoint programmatically.

To start with we need to activate the feature called document set at the site collection level.

If you would like to know more about document set, then I would recommend you reading Understand Document Set to get a fair idea on what document set is and what it offers.

I have one document library with the name Shared Document. To add document set programmatically, we first need to enable the content types on this library. So go to the library settings, advance settings and enable the allow management of content types.

Now click on add from existing content types.

On the page look for document set content type and add it to the library.

So you should have something like this



Now I am showing this with an example of feature activated event. I have one feature and on activating the feature I am creating a document set programmatically.

Here is a code that you need to write.



Now if you see what we have done here is first we have taken document set content type in to a code from current web. This will not work if you have not activated document set feature at a site collection level.

Document set has properties, so we have set one property - document set description. This needs to be done with HashTable.

Then we are creating a document set by DocumentSet.Create method. To get this done you need to add reference to one DLL and for the HashTable you need to one DLL.

These are the DLLs you need to refer.

using System.Collections;
using Microsoft.Office.DocumentManagement.DocumentSets;

After creating Document Set, the important line of code to note is the ProgId of the item to be set to SharePoint.DocumentSet.

If you do not do this, then all you get is just a folder and not actual document set. You can see the difference in the icon as well as when you click on the folder.

Finally we update the item.

So let's deploy the WSP and activate the feature and see what happens.



See the icon. Icon indicates that this is the document set and not the plain folder. Click on the title.



See the description is also set. You can also set additional properties at the time of creating document set.

I hope this helps.


Thursday, March 28, 2013

Add web part page using PowerShell


Imagine a scenario where you need to create 100 web part pages with different templates. You would spend a lot of time creating those pages. One of the approaches can be having a PowerShell script which can create web part pages for templates that you want.

Here is a simple script that creates web part pages in a loop.

[xml]$xmlfile = Get-Content ConfigFile.xml 

foreach( $sitecoll in $xmlfile.Configuration.SiteCollection) 
{ $site = $sitecoll.name }

 $spSite= Get-SPSite $site 
$web = $spSite.OpenWeb() 
$layoutTemplate = 4 # Template code 
$web = $spSite.OpenWeb() 
$list = $web.GetList("/sites/SharePointSite/SitePages/")
 $i = 1
 while ($i -le 5)
 { Write-Host $pageTitle = "WebPartPage& + $i 

$xml = "<?xml version=""1.0"" encoding=""UTF-8""?&gt;

<Method ID=""0,NewWebPage""><SetList Scope=""Request"">" + $list.ID + "</SetList><SetVar Name=""Cmd"">NewWebPage</SetVar><SetVar Name=""ID"">New</SetVar><SetVar Name=""Type"">WebPartPage</SetVar><SetVar Name=""WebPartPageTemplate"">" + $layoutTemplate + "</SetVar><SetVar Name=""Overwrite"">true</SetVar><SetVar Name=""Title"">" + $pageTitle + "</SetVar></Method>"

 $result = $web.ProcessBatchData($xml)

 $i++ 

Write-Host -foregroundcolor Green $pageTitle 'created successfully' 

}

and when you run here is the output of the script and then final result



If you observe closely here we have specified layouttemplate, we have specified 4. This related to various templates like three column, four columns, headers the template that we select while creating web part page.

 Possible LayoutTemplate values are :

# 1 - Full Page, Vertical
# 2 - Header, Footer, 3 Columns
# 3 - Header, Left Column, Body
# 4 - Header, Right Column, Body
# 5 - Header, Footer, 2 Columns, 4 Rows
# 6 - Header, Footer, 4 Columns, Top Row
# 7 - Left Column, Header, Footer, Top Row, 3 Columns
# 8 - Right Column, Header, Footer, Top Row, 3 Columns


Sunday, January 6, 2013

What is an App in SharePoint 2013



App is similar to a web part. One main key difference is everything is at the client side and not on the server side when you write a code developing an app which is called client web part.

In SharePoint 2013 Lists and Libraries are now termed as apps.

SharePoint now has its own app store where we get some free apps and some paid apps which can be installed and then can be used inside SharePoint.

There are three hosting options when you create app for SharePoint.

1) SharePoint hosted - On Premises.
2) Externally hosted
3) SharePoint Online - Sandbox solutions can be created. (deprecated now in SharePoint 2013) or new apps web part (client web part) can be used.

Certain important points about an app are :
  •       App cannot have any server side code.
  •      Apps  get created in a special “app web” on a special URL which is isolated from the original SharePoint web. Each app is a part of dedicated site collection.
  •      App does not have permission to talk to the parent site or site collection
  •     App cannot talk to the host site. ( a site in which app is displayed)
  •       Apps can be created using Visual Studio 2012     or using "Napa" Office 365 Development Tools
So SharePoint 2013 apps do not live in SharePoint rather they execute within the browser client or in a non-SharePoint server such as IIS or Windows Azure.

Apps can only be added by users with Full Control permission to the site. As mentioned earlier Apps can be installed from the centralized app store from on premises SharePoint or from public app store.

Apps can also be opened as a full browser screen or can also be a part of page. When we want app as a part of page we can use app part just like a web part to display that app in the app part. App part will display content of that app part in Iframe html element.

Regardless of how you authenticate your app with SharePoint, you need to have user consent to perform actions. You declare the required permissions in the app manifest file while developing, and the user is asked to grant or deny those permissions to the app during installation.

You can connect your app with just about any internal or public web services, take advantage of the new OAuth 2.0 support in SharePoint, and use the Representational State Transfer (REST) and client APIs (JavaScript and .NET) to integrate and connect your app with SharePoint.

There is a list of available apps that can be downloaded (some free / some paid versions) from Microsoft market place for SharePoint 2013.






Thursday, January 3, 2013

What's new in SharePoint 2013


Here we are with new SharePoint 2013. With this edition comes lots of fun and also up to some level disappointment. Well, there are more fun than disappointment hence a good news.
First let us see what all new features of SharePoint 2013 and what all product family now we have.

First SharePoint 2013 is of course a next version of currently successfully running SharePoint 2010.

Just like SharePoint Foundation 2010 we also have SharePoint 2013 foundation which is again a free utility that can be downloaded if you have Windows Server 2008 R2 with SP1 or new Windows Server 2012.

we also have licensed SharePoint 2013 on premise version or the cloud version which is in office 365.

Covering everything about SharePoint 2013 would be very difficult in a single post. So we will divide the posts and will post them as separate posts.

It would only run on 64 bit machines and will require SQL Server 2008 R2 with SP1 or new SQL Server 2012.

Ideal RAM should be between 8 GB to 24 GB. (making hardware more expensive with each iteration)

Plus Microsoft has come up with new Visual Studio 2012 which is tightly integrated with SharePoint 2013. Visual Studio 2012 has a lot of new features eases the SharePoint 2013 development.

Of course we now also have SharePoint Designer 2013 as well as Office 2013 products.
So let's dive into the new features that has been introduced or enhanced from the previous version.

1) Everything is App

Now we need to think of almost everything as an App. Lists, Libraries, Calendar and even sites are apps. You can create an app and then publishes to the corporate app web application or to the Microsoft Store. Remember that when you create an app, you will work with client object model and not server object model. You can use ECAM script, HTML and jQuery to interact with SharePoint 2013. you can options to host your app either in SharePoint itself or on the cloud - provider hosted.

The advantage is Microsoft is going to have a dedicated store for SharePoint where developers from all around the world would be publishing their apps for SharePoint which then can be consumed by other developers based on contract/license.

Company developed apps can be hosted in internal app catelog. They enable you to use cross-platform standards, including HTML, REST, OData, JavaScript, and OAuth.

We already have few apps ready to go for SharePoint 2013 and here they are.

http://office.microsoft.com/en-us/store/apps-for-sharepoint-FX102804987.aspx

2) Create / Edit Master Pages

This is one of the biggest improvements over the last version.

You can simply create an HTML page with CSS and images and then convert this HTML page into the master page. Does that really make you read twice? Yes, you're right. We can now convert HTML into the fully functional master page. you also get a preview of new master page before applying.

3) Image duplicity

You can have all your images in a site and then can define the variants of those images that you would like to use. You can have one single image and can use this image in different way like with different height, width and even by cropping an image.

4) Windows 8 Style
You feel like you are using Windows 8 UI metro look as we have now tiles at most of the places.

5) Contemporary view for Mobile

We now have new contemporary view for mobile. This view is available in HTML 5 to those who uses Windows Phone 7.5 or above and IE 9 and above, iPhone 4 or above, Safari 4 or above and Android 4 or above.

We can also have full desktop view of SharePoint in smart phones.

6) Drag and Drop to library

Now we can upload the documents using drag and drop from the desktop. Files will be uploaded to the document library showing the progress bar.

7) New context menus

We now have more clear context menus for list items and documents.

8) Share the documents

Now we can select document and then share it with specific person / user with personalized message. After this email will be sent to the user so that user can access the document.

9) Social experience has improved

Now you can follow a document, list item and also users, posts etc. You can do a micro blogging.

There is a new community site available where you can define you ideas, team, contributors and can also give them ranks / raputations based on the answers that they give when someone post a question. You can create badges.

10) Preiew of Documents

Now in document library when you hove the mouse over the document, we get to see the preview of that document right there.

11) SkyDrive integration

You can synchronize your contents to your desktop with the SkyDrive.

12) BCS enhancements

Now it also suports oData. automatic generation via Visual Studio.

13) create an app for Office 2013

We can create an app specially for Office 2013 so that users using office 2013 can interact with SharePoint 2013 right from office. We can use new development tool called "Napa" along with Visual Studio 2012.

14) App event handlers and remote event handlers

apps have their own events that we can handle like when app is installed or deleted. Remote event handlers can work with the remote components of the app for SharePoint.

15) Translation service, PowerPoint automation service, enhanced excel service and enhanced access services.

With new PowerPoint automation service you can now convert ppt or pptx files to PDF and other open XML formats.

Translation Service is a new service application in SharePoint 2013 that provides translation of files and sites. When the Translation Service application processes a translation request, it forwards the request to a cloud-hosted machine translation service, where the actual translation work is performed.

The Machine Translation Service application processes translation requests asynchronously and synchronously. Asynchronous translation requests are processed when the translation timer job executes. The default interval of the translation timer job is 15 minutes; you can manage this setting in Central Administration or by using Windows PowerShell

There is a lot of things that can be talked about SharePoint 2013. We will cover them as an when we come across to them and share it.



Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com