Saturday, June 1, 2013

Offset Today in SPQuery Example

There is a virtual situation :

You have no archival / expiration policies setup for your list and on and off you want to delete everything older than 30 days . What you will do ?

This sample power shell solves your purpose and fulfill example for offset parameter in powershell :

$WebURL = "http://mysitecollection:100/myWeb";
$spWeb = Get-SPWeb -Identity $WebURL;

$sList = $spWeb.GetList("/myWeb/Lists/myList");
write-host $sList.Title;
$camlQuery = "<Where><Lt><FieldRef Name='Modified' /><Value Type='DateTime'><Today OffsetDays=-30 /></Value></Lt></Where>";
$spQuery = new-object Microsoft.SharePoint.SPQuery ;
$spQuery.Query = $camlQuery ;
$spQuery.ViewFields = "<FieldRef Name='ID' />";

$ToBeDeleted = $sList.GetItems() ;
$ToBeDeleted = $sList.GetItems($spQuery) ;
$i=0;
$ToBeDeleted | ForEach-Object {
$i++;
Write-Host $_.ID -foregroundcolor cyan

$deaditem= $sList.GetItemById($_.ID);  # if you wish you may decide to recycle instead to recycle bin

$deaditem.Delete();

}

write-host $i;

 

 

Authorization/Authentication

Authentication is determining the identity of a principal trying to log in via IIS . When a principal tries to authenticate to a system, credentials are provided to verify the principal's identity.

            Microsoft Online IDs  are issued and maintained by Microsoft - like ids for  Office 365,               Hotmail, Sky Drive, and Live account.Using a Microsoft ID, a user can authenticate to various systems using same credentials.

             Federation Identity  (Single Sign-On) is a mechanism for allowing users within your organization to use their standard Active Directory corporate username and password toaccess Office 365.Federation with Office 365 requires the use of Active Directory Federation Services (ADFS)2.0.


Authorization is verifying an authenticated user's access to a application as per Access Control List (ACL).When a user tries to access the SharePoint site collection, their username is checked against the permissions of the site via SharePoint Groups or directly. If no permission is been granted, access is denied .

You may also like:


Friday, May 31, 2013

Include specific folder content in BlobCache SharePoint

It is quite possible that you instruct blob cache framework to include only specific SP document Libraries . ( I have mentioned it as document libraries , as you must be aware it does not work well with custom folders created using designer etc)

Suppose I have few heavy .jpeg  and .dhx  in a spdocumentLibrary called  HeavyContent .

I want to cache all .pdf , .doc ,.docx ,.flv,.f4v ,.swf  in my web application , but  .jpeg and .dhx   are the one only from spdoc lib "HeavyContent"

Search for a tag similar to below mentioned  in web.config and edit the path parameter.  :

<BlobCache location="C:\myBlob\Public" path="(\.(doc|docx|pdf|swf|flv|f4v)$|HeavyContent.*\.(dhx|jpeg)$)" maxSize="10" max-age="86400" enabled="true" />

This will mark items as specified by path parameter regex  for 24 hrs , to be cached.

\.(doc|docx|pdf|swf|flv|f4v)$    <---->  everything which ends with extension mentioned

|                                            <---->   or

HeavyContent.*\.(dhx|jpeg)$ <----> content inside HeavyContent ending with dhx or jpeg



Disclaimer : I am not sure how performance will be affected by making path parameter complex.


Mime Types with BlobCache

Now suppose your IIS does not support some mime types like dhx and f4v.  You have two options :

Option 1 : add mime type at server level in IIS.

Option 2 : use    browserFileHandling = "Nosniff"  in the webconfig section discussed above.  [ Ref : http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx ]
How to  Flushing the BLOB cache



  1. IISRESET [Recommended : Increase the startup and shutdown time limits on the web application to accommodate the extra time it takes to initialize or serialize the cache index for very large BLOB caches]

  2. Powershell :



Write-Host -ForegroundColor White ” – Enabling SP PowerShell cmdlets…”
If ((Get-PsSnapin |?{$_.Name -eq “Microsoft.SharePoint.PowerShell”})-eq $null)
{
$PSSnapin = Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
}


$webAppall = Get-SPWebApplication
foreach ($_.URL in $webAppall) {
$webApp = Get-SPWebApplication $_.URL
[Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp)
Write-Host “Flushed the BLOB cache for:” $_.URL
}
3. change enable to false in web.config , change location parameter , set enable to true


You may also like:







Watson bucket parameters

 

Anybody help to understand , what this means in ULS logs ?

------>

05/29/2013 08:22:02.49 w3wp.exe (0x1D38) 0x0DD4 SharePoint Server Unified Logging Service c91s Monitorable Watson bucket parameters: SharePoint Server 2010, ULSException14, 81eed5e0 "web content management", 0e00129b "14.0.4763.0", e9185677 "system.web", 0200c627 "2.0.50727.0", 4ef6c43b "sun dec 25 01:35:39 2011", 00002164 "00002164", 00000083 "00000083", 454b2bb9 "httpexception", 386e3162 "8n1b" 47e538f0-8fa3-4d3b-8010-1988b2590981

Sunday, April 21, 2013

Sunday, April 14, 2013

Create Variation Hierarchies with Machine Translation Enabled

Prerequisites

Before we start creating variations in SP 2013 and test machine translations, below mentioned two Managed services must be present:
•          Machine Translation Service
•          User Profile Service Application
You can use configuration wizard on home page of central admin (http://centralAdmin/configurationwizards.aspx) to create all services.
• Application pool account used for machine translation service must have full control on User profile services. This application pool account must have permissions on http://servername/TargetSiteCollectionPath/Translation%20Status/
• Download latest certificates from https://corp.sts.microsoft.com/Onboard/CertRenewal.html and install on SharePoint farm.
• Visit https://www.microsoft.com ( run as administrator) > Page properties > Certificates > Install certificates on the SharePoint Farm








Create Variations in SharePoint 2013


Create   publishing portal from central admin (http://centraladmin/_admin/createsite.aspx)






Create Hierarchies

  1. Visit In site settings of root for site collection and go to Variation Labels (http://servername/sites/var/_layouts/15/VariationLabels.aspx) :

  2. Create  root variation label :







3. Create a target / child variation label :







Please make sure you have allowed machine translations for this target:









4. Now click on link to create Variation hierarchy   :







5. Either wait for Variations Create Hierarchies Job Definition and Variations Propagate Sites and Lists Timer Job to run as scheduled or run them manually. You can verify   what actions these jobs are taking @ http://servername/sites/var/VariationLogs/AllItems.aspx

6. After variations are created http://servername/sites/var/_layouts/15/VariationLabels.aspx looks like :






Machine translation



Create page on root variation






Publish and approve this page.

Manually run Variations Propagate Page Job Definition or let this job run as scheduled.

Visit Variation Logs (http://servername/sites/var/VariationLogs/AllItems.aspx) to verify page is being propagated to target variation.


Submit page for Translation on Target Variation


Visit the test page and click on machine translation tab :





Output:







Publish and Approve the page after required edits.

You may also like:

SharePoint 2013 features overview

Thursday, March 14, 2013

Refiners in SharePoint 2013 Search

We will try to understand how refiners work in SharePoint 2013 here.

Refiner webpart passes a Jason object in url .



1. Go to view all site content ( http://servername/sites/var/_layouts/15/viewlsts.aspx)

2. Create a Custom List similar to mentioned below :




Column TermSetColumnPOC ( Allow multiple values) is linked to a termset withTerms :

Term1 , Term2 , Term3 , Term4 , Term5 ,Term6 , Term7 , Term8 ,Term9

I want my search result page to display results  when "Term8"  is present in column TermSetColumnPOC or NormalColumnPOC  . I will also provide a filter , which will hide the results which don't have "Term8"  present in column TermSetColumnPOC .

2. Populate data in custom List :



Searching "Term1" should give items hk1 , hk4 , hk7, hk9

Searching "Term8" should give hk1, hk6,hk8

Now applying Refiner on "TermSetColumnPOC" equal to value  "Term8"  should give only hk1,hk8

3. Create a Content Source under Search administration in central admin which contain only your test web application to be crawled . This is not a mandate , but will expedite this process of testing refiners , as you will drastically reduce crawling time.

Run a full crawl on this search content source.



4.   Search Service application > Search Schema

Create a managed property "TermSetColumnPOCManaged" as mentioned below











5. Run full crawl  again.



6. After this crawl is over , you can test refiners in your search center . I don't want one so , I will create my own simple page.

7.  Enable site collection feature "Search Server Web Parts and Templates"





8.  Create a simple web part page and insert below mentioned webpart on page

Search Box , Search results , Refinement



9. Under Webpart properties of refinement  webpart choose TermSetColumnPOCManaged as one of the available refiners.



10 . Publish and approve this page .

11.  Type "Term1"  in search box or Type url   http://......./search1.aspx#k=Term1



11.1 Type "Term8"  in search box or Type url   http://......./search1.aspx#k=Term8



11.2 Type "Term8"  in search box and Click on "Term8"   in Refiners

( use url decode to understand what is being passed in url )

or

http://......./search1.aspx#Default={"k":"Term8","r":[{"n":"TermSetColumnPOCManaged","t":["\"ǂǂ5465726d38\""],"o":"and","k":false,"m":null}]}

( here equivalent json object is passed as parameter )

or

http://......./search1.aspx#Default={"k":"Term8","r":[{"n":"TermSetColumnPOCManaged","t":["\"Term8\""],"o":"and","k":false,"m":null}]}

( here equivalent json object is passed as parameter  but with Term display value )



11.3 search "TermSetColumnPOCManaged:Term8"  or 

type url  http://......./search1.aspx#k=TermSetColumnPOCManaged:Term8





Another example of JASON with Refiners and Search core result webpart :

On the same page Search "Term1" , and in Refiners , select "Term1"



or type url :

http://......./search1.aspx#Default={"k":"Term1","r":[{"n":"TermSetColumnPOCManaged","t":["\"Term1\""],"o":"and","k":false,"m":null}]}

The result in both ways :





One more example of jason with Search result page :

On the same page Search "Term1" , and in Refiners , select "Term9"

or type url :

http://......./search1.aspx#Default={"k":"Term1","r":[{"n":"TermSetColumnPOCManaged","t":["\"Term9\""],"o":"and","k":false,"m":null}]}

Result both ways comes to be :





You may also like:

SharePoint 2013 features overview