Thursday, April 3, 2014

How to load .Net 4 compiled dll in Powershell ?

Do you get error like :

Exception calling "LoadFile" with "1" argument(s): "This assembly is built by a runtime
newer than the currently loaded runtime and cannot be loaded. (Exception from HRESULT:
0x8013101B)"

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.