Thursday, April 3, 2014

How to generate Facebook token ?


  • Do you have your app already on Facebook Developer site?

How to read online xml using PowerShell?

This post demonstrate how you could read an xml file and manipulate using PowerShell.
# I have taken this site's sitemap as sample xml

$onlineXMLSitemap = "https://hemantrohtak.blogspot.com/sitemap.xml" ;
$doc = New-Object System.Xml.XmlDocument;
$doc.Load($onlineXMLSitemap);

# you could manipulate this xml just like an ordinary xml in object model
#below mentioned: Print a random url from my sitemap

$doc.urlset.url | Get-Random -count 1 | ForEach-Object {

Write-Host $_.loc ;

}

Sample Code :

# I have taken this site's sitemap as sample xml
$onlineXMLSitemap = "https://hemantrohtak.blogspot.com/sitemap.xml" ;
$doc = New-Object System.Xml.XmlDocument;
$doc.Load($onlineXMLSitemap);
# you could manipulate this xml just like an ordinary xml in object model

Saturday, February 22, 2014

Can I stop my screen from locking due to inactivity?

Tonight I was watching movie on my TV being broadcasted via HDMI from my Laptop.

It was annoying to force my laptop from dying every now and then.  (Somehow I was not able to change power management settings to never sleep, don’t know why!!!)



So I quickly wrote this PowerShell script, to keep on clicking at random places on my screen:

Thursday, November 21, 2013

Do you want to spend on SharePoint only for MS Office DocumentCollaboration ?

First you should know How to collaborate with SharePoint 2013 :



Now Let's see what Google provides :

Sunday, September 1, 2013

List View Threshold

List View Threshold


Sometimes you might face a situation where you get this error:

9239 items (list view threshold is 5000)

The number of items in list exceeds the list view threshold, which is 5000 items.  Tasks that cause excessive server load (such as those involving all list items) are currently prohibited.

Even though it is recommended to use prescribed limits in your queries, but

Thursday, August 1, 2013

List and Site templates in SharePoint

List Templates


Any List/Library in SharePoint can be saved as template (STP) .

Go to List/Library > Library Settings > Save document Library as Template

  1. Provide File Name, Template Name and Template description ( you can choose to include content of source in the template)

  2. You can visit List template gallery (Site settings > List template gallery) , and your template will be found saved there.  You can easily open the list template gallery in explorer view and extract the stp file on your hard disk. This can be uploaded on any site collection as target.

  3. This template is available for new list creation in current site collection wherever this List template stp file is available under List Template Gallery. Visit Site Content >Add an App > you will find your template to create new List/Library here.



  • You would be able to create a List/Library with same set of columns and views as the source of template


Please visit Library settings and observe different list settings like version setting metadata navigation, security etc.

 

Site Templates


A sub site can also be saved as template.

Go to site settings > Save site as Template

  1. Provide File Name, Template Name and Template description. Description (you can choose to include content of source sub site’s list and libraries in the template.)

  2. Please note site template is being saved as a wsp under Solution Gallery ( /_catalogs/solutions/forms/allitems.aspx)  This can be uploaded on any site collection as target.


 

  1. Go to Site content > New sub site > under template choose custom   and you can create a replica of source sub site.


 

Caution:



  • Security settings are not saved in List / site Templates

  • Default max size for list/site templates is 50 MB which can be changed by administrator. But you won’t go beyond 500 MB though


$tSize = 50000000

$myW = [Microsoft.SharePoint.Administration.SPWebService]::ContentService

$myW.MaxTemplateDocumentSize = $tSize

$myW.Update()

 

  • List definition / site definition based on which source list / sub site was created, must be present on target.

  • List / site templates are saved in content data base of site collection.

  • Once target is created using a template, it has no relation with template. These templates are only scripts to create the target. If you missed something in source before creating a template, redo creation of target.

  • If you are looking for code level high customization on the top of default list definition, better you choose custom list definition than list/ site templates.

Wednesday, July 24, 2013

Cannot create Variation site because the parent Publishing web cannotbe found. Ensure the parent Publishing web has been spawned and tryagain

To create a child variation to root variation we create a new label under Variation Labels [http://newServerName/_Layouts/_Layouts/VariationLabels.aspx] and after this click on Create Hierarchies button on this page. 

When timer job "Variations Create Hierarchies Job Definition" runs , it tries to create the child variation site including subsite of child variations. This also includes publishing Pages Library and publishing pages.
Current status can be verified under Variation Logs[http://newServerName/_Layouts/VariationLogs.aspx]
I was trying to use timer job "Variations Create Hierarchies Job Definition" to create a child variation [es-LA] to root variation[en-US] .

But I was getting error (under Variation Logs) :

A new site sub1Site1 did not get created under Label es-LA by the variation system for source site http://newServerName/en-US/sub1Site1. Cannot create Variation site because the parent Publishing web cannot be found. Ensure the parent Publishing web has been spawned and try again.

AND

Pages did not get created under Label es-LA by the variation system for source publishing web http://newServerName/en-US/sub1Site1 because the target publishing web cannot be determined.


Below mentioned solutions did not work for me :

1. Fix the possible misalignments like problem in the relationships list[http://newServerName/Relationships List/AllItems.aspx] using VariationFixUpTool.
2. In the SharePoint file C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Resources\cmscore.es-ES.resx (installed by the language pack for Spanish)

Change the value of List_Pages_UrlName as seen below

<Data Name="List_Pages_UrlName">

<Value>Pages</Value>

</Data>

to

<Data Name="List_Pages_UrlName">

<Value>Paginas</Value>

</Data>

Save the file. Now go and restart the SharePoint 2010 Timer service. Then create the Spanish Variation.  [

Eventhough "List_Pages_UrlName" solution did not work for me for this specifc problem , but with Spanish sites you get funky behaviour out of URLS retrived from Microsoft.SharePoint.Publishing.PublishingWeb.PagesList SPobjects ,
you can give it a try !!!!]

Below mentioned solution worked for me :
1. Disable all custom built features on root variation. (spweb level features)
2. Now create new Label , submit variation creation on Variation Labels and run timer job "Variations Create Hierarchies Job Definition".
3. I was still facing issue 0x80070057 which is discussed here as a separate thread.
4. After resolving issue 0x80070057 , child variation was created.
5. Now enable all custom built features on both root variation and child variation.





0x80070057
Access "Pages" Library for Chinese Locale