Monday, 25 May 2015

How to update the list items without changing the modified by values.

We written a PowerShell script instead of doing manual work, we can do it easily while spending little bit time J
We want to update a field value in a particular list for all items based on the condition, without affecting the modified by and created by values.

$web = Get-SPWeb http://dotnetsharepoint.com/sites/sharepoint2013
$list = $web.lists["Your List Name"]
#Geting  all items in particular list and save them to a variable
$items = $list.items
#Go through all current list items
foreach($item in $items)
{
#If the "CurrentStatus" column value equals "NO"
if($item["CurrentStatus"] -eq "NO")
{
#Change the value of the "CurrentStatus" column to “YES”
$item["CurrentStatus"] = "YES"
$modifiedBy = $item["Editor"]
$modifieddate = $item["Modified"]
$item["Title"] = "Modified in PowerShell"
$item["Editor"] = $modifiedBy
$item["Modified"] = $modifieddate
$item.Update()
$list.Update()
$web.Dispose()
}




SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Sunday, 24 May 2015

group by more than 2 columns sharepoint 2013

In this article we will explain, how to create multi level group by more than two columns.
We are having a list with name “RajamouliFilmography”, now we want to create multi-level hierarchy “Group By “with more than 2 levels.

In OOTB it’s not possible to create more than 2 levels of Group by, but using SP Designer we can achieve this functionally.


Open the Site in SharePoint Designer

Click on Site Pages->In the Top click on web part page->select any page layout ->Enter the Page name.

Now click on the Page->Edit the file.
We placed the cursor inside the Zone Template, but Data View is in disabled.
In SharePoint 2013 we cannot add the Data View directly.
To enable Data View we have to convert the page in to HTML, for that click on the Parse HTML as shown in the below screen shot.
Again navigate to INSERT tab, there we can able to see the Data View is enabled stage, place the cursor inside the Zone Template, and click on Empty Data View.
Once we added the Empty Data View, in-between the Data Sources tag add the List.
Once we added the list, in the right hand we can able to see the Data Source Details.
Press Ctrl tab and select the columns that you want to give Group By, then click on Insert Selected Fields ->Click on Multiple Item View.
In the Option Tab Click on Sort & Group, it will pop a window, there we have to select the Fields and click on add that you want to give Group by
We added the fields in an order that we want to create group by Year, Film, and Hero Name, Select the Check box option for all the fields Show group header.
Click on Ok.
Save the page and then click on preview browser.
Now we can able to see the more than 2 levels of hierarchy structure.



Please let me know if anyone having quires on this article.

SharePoint Online  Training Contact: sharepointtraining@dotnetsharepoint.com

Saturday, 23 May 2015

Hide the SharePoint list column in “New from” using PowerShell

In this example we want to hide the column in the "NewForm.aspx" page, we are hiding the “hide column” using the below Power Shell script.


#Get the site that you want to access the list
$webUrl = Get-SPWeb http://dotnetsharepoint/sites/sharepoint/
#Get the list name
$listname = $webUrl.Lists["DemoHideColumn"]
#Get the Column that you want to hide
$columnName = $listname.Fields["HideColumn"]
# hide the column from New Form using the ShowInNewForm property
$columnName.ShowInNewForm=$false
#if you want to show it again change to $true
$columnName.Update()
$listname.Update()
$webUrl.Dispose()

After completing the Power Shell we can get the Output as shown below in the NewForm.apsx.


Friday, 22 May 2015

Could not find file 'C: \Users\SharePoint\AppData\Local\Temp\374d35h38-f654-gf66-463f-gg17a0d453hh\ExportSettings.xml

We take the backup of site in one server using.

Export-SPWeb http://dotnetsharepoint.com/sites/dotnet/dotnetsharepoint/ –Path "C:\DotNetSharePoint.cmp" –includeusersecurity

Example:

DotNetSharePoint.cmp
DotNetSharePoint1.cmp
DotNetSharePoint2.cmp

  We copied the .cmp file to other server and tried to Import  using the below command.

Import-SPWeb http://dotnetsharepoint.com/sites/dotnet/sharepoint/ -Path "C:\DotNetSharePoint.cmp"  -IncludeUserSecurity -Force

While trying to Import we got this error.

“Could not find file 'C;\Users\SharePoint\AppData\Local\Temp\374d35h38-f654-gf66-463f-gg17a0d453hh\ExportSettings.xml”

Root Cause of this Issue in my case: We missed one .CMP file while copying one server to another Server.

DotNetSharePoint.cmp
DotNetSharePoint1.cmp


Finally after copying all 3 files it is working without any issues.

How to get the field guid using PowerShell

Using PowerShell we can get the field guid easily in our SharePoint.

# to get the site that you want to hide the column


#Get the list you want to access
$listname = $web.Lists["YourListName"]

#Get the field that you want to get guid
$ListCol = $listname.Fields["YourFieldName"]
Write-host "List column GUID is:"$ListCol.id


Run the Power shell script in the Management Console, Hit Enter we can easily get the output.

Wednesday, 20 May 2015

Remove user from site collection and its sub sites.

Sometimes we have to remove user/users from inside the group or outside of the group from the site collection and its sub sites, even if the list and site having unique permissions we can delete users easily without Power Shell.

.We can achieve this using GUI

Navigate to site settings
Click on Site permissions->click on any SharePoint group
In the top URL we can able to see like this
For every group having having a unique id.
change the 85 to 0 in the URL, it  will display all the users, select the check box that you want to delete.
 In the tool bar we can able to see the Actions,clink on the actions ->click on delete users from site collection.

It will remove the users form site collection, sites and sub sites.

Monday, 18 May 2015

Blocked file is not migrated to SharePoint

While doing the migration from lotus notes to SharePoint, we got an error and warning in the log file with “Blocked file is not migrated to SharePoint id = “” name=”” size =”” “.

Causing of this issue is we need to remove the file extension block file in the tool and we need to change the file Size limit in the tool as shown in the below screen shot.
        1)Navigate to “Migrator Notes to SharePoint”->right click and click on “Advanced configuration Options” there click on SharePoint tab as shown below.
If we want to keep any file limit means we have to mention otherwise for no limit use "o or blank".

      2)  In the blocked file extensions, we can remove the file type if you want to migrate.

Once all done, migrate next time we won’t get this type of warning or error “Blocked file is not migrated to SharePoint”.