kwizcom banner advertisement

Remove Field from View using PowerShell in SharePoint

November 30, 2015    , , , , ,
How to Remove Column from View in SharePoint? Browse to your list or library in SharePoint >> Click on the List or Library tab from ribbon. Click on "Modify View" button under "Manage Views" group. In Edit View page, uncheck the column(s) you wish to remove from the particular View. Click OK to save. If you want to remove field from view programmatically using PowerShell, Here you go: SharePoint delete column from view using PowerShell: Here is the PowerShell to remove column from view. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Function: sharepoint powershell delete field from view Function Remove-FieldFromView([Microsoft.SharePoint.SPList]$List, [String]$ViewName, [string]$FieldInternalName) { #Get the view $View = $List.Views[$ViewName] If($view -eq $Null) {write-host "View doesn't exists!" -f Red; return} #Check if view has the specific field already! if($view.Vie
Remove Field from View using PowerShell in SharePoint Remove Field from View using PowerShell in SharePoint Reviewed by Salaudeen Rajack on November 30, 2015 Rating: 5

Create Content Type Hub in SharePoint 2013

November 30, 2015    , , , , , , ,
What is Content Type Hub SharePoint 2013? Content Type Hub is a centralized repository of SharePoint Content types where we can manage and publish content types. Any Web application that subscribed to this content type hub can consume content types from this store. Content type hub is associated with the help of Managed Metadata Service Application. Why we need content type hub in SharePoint? Well, content types are limited within site collection scope. When you have a requirement to consume content types beyond site collection boundary, or even between different SharePoint farms (E.g. Dev-UAT-Production) - Content type hub is the answer! Without content type hub, You'll end up creating same content type again and again on all of the site collections - I'm sure this situation is pretty common in your  organization. How to configure content type hub SharePoint 2013? Content Type Hub is actually a Site Collection. You can either create a dedicated web application and then
Create Content Type Hub in SharePoint 2013 Create Content Type Hub in SharePoint 2013 Reviewed by Salaudeen Rajack on November 30, 2015 Rating: 5

Cascading Dropdown in SharePoint List using Infopath Forms

November 28, 2015    , , , , ,
What is Cascading drop downs? Well, Cascading drop downs are linked drop down controls where the content of the second drop down depends on the selection of the first one. E.g. When you Choose Country in the first drop down, the second drop down State is automatically filtered to the list of states actually in that county. Cascading drop downs are quite a common requirement and unfortunately, SharePoint doesn't support it Out of the box. In this article, I'm documenting the implementation of cascading drop down functionality in SharePoint list forms using InfoPath forms step by step (at least for my own reference! even a simple mistake takes hours to resolve). In short: You create a new data source to retrieve "Region" and "Country" columns from the Countries list and then filter the countries drop down to show only items matching with the "Region" selected in "Regions" drop down. Cascading Drop down List Setup: Here is my List se
Cascading Dropdown in SharePoint List using Infopath Forms Cascading Dropdown in SharePoint List using Infopath Forms Reviewed by Salaudeen Rajack on November 28, 2015 Rating: 5

Create Word Automation Service Application using PowerShell in SharePoint 2016

November 27, 2015    , , , ,
The Word Automation Services Service Application provides developers a way to perform server-side conversion of documents that are supported by Microsoft Word (such as .doc, .docx, .rtf, etc) into other formats such as PDF,XPS, RTF, Docx,etc. In other words, Word Automation Services provides the "Save As" like functionality of the Microsoft Word client for SharePoint. How to Create Word Automation Service Application using SharePoint 2016 Central Administration: To create a Word Automation Service Application from SharePoint 2016 Central Administration site, Go to: Application Management >> Manage Service Applications. On the Service Applications tab, click New >> and then click Word Automation Services Application. In the Create New Word Automation Services Application dialog box, Enter the Name, Application Pool, Select "Add to Default Proxy List" and click on next. Enter the Database Server name and name of the database for word automation
Create Word Automation Service Application using PowerShell in SharePoint 2016 Create Word Automation Service Application using PowerShell in SharePoint 2016 Reviewed by Salaudeen Rajack on November 27, 2015 Rating: 5

How to Remove Content Database in SharePoint using PowerShell?

November 26, 2015    , , , , , ,
SharePoint content databases are the most important artifacts in SharePoint platform as they hold majority of the data. However, at times we may have to delete the content database from SharePoint. Here is how you can utilize PowerShell to delete database: How to delete content database in central administration? Login as a Farm Administrators and follow these steps to delete content database in central administration. Go to SharePoint Central Administration >> Application Management >> Manage Content Databases in the Databases section Select the web Application from the drop down menu and click on the name of the content database.  In the Manage Content Database Settings page, select "Remove content database" check box.  Confirm the prompt and Click on OK to to delete content database in sharepoint. This detaches and removes the association of the content database from SharePoint. However the content database still exists in SQL Server. If you want to
How to Remove Content Database in SharePoint using PowerShell? How to Remove Content Database in SharePoint using PowerShell? Reviewed by Salaudeen Rajack on November 26, 2015 Rating: 5

Get/Set Hyperlink Field Values in SharePoint using PowerShell

November 22, 2015    ,
Here is my PowerShell scripts to get and set hyperlink column values: Get Hyperlink Field Value using PowerShell: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Configuration Variables $SiteURL = "http://intranet.crescent.com/" $ListName = "UserProfiles" $FieldName="Picture" #Get the Web, List Objects $web = Get-SPWeb $SiteURL $List = $Web.Lists.TryGetList($ListName) If($list) { foreach($Item in $List.Items) { #Get the Hyperlink column $Picture = New-Object Microsoft.SharePoint.SPFieldUrlValue($Item[$FieldName]) #Get the URL of the Hyperlink $Picture.URL #Get the Decription - Title $Picture.Description } } Update Hyperlink Field value using PowerShell: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Configuration Variables $SiteURL = "http://intranet.crescent.com/" $ListName = "UserProfiles" $FieldName=&q
Get/Set Hyperlink Field Values in SharePoint using PowerShell Get/Set Hyperlink Field Values in SharePoint using PowerShell Reviewed by Salaudeen Rajack on November 22, 2015 Rating: 5

Export Document Library File-Folder-SubFolder Structure to CSV

November 20, 2015    , ,
Requirement: Get the complete structure of all folders-subfolder-files from a SharePoint document library and export to CSV file. PowerShell Script to Iterate through each folder and Sub-folder and get all files: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Custom Function to get all files of a folder Function GetFiles-ByFolder([Microsoft.SharePoint.SPFolder]$Folder) { write-host "Processing Folder:"$Folder.URL Foreach($File in $Folder.Files) { $content = $Folder.Name + "," + $Folder.URL +"," + $File.Name Add-content $OutPutFile $content Write-host $content } } #Variables $WebURL="https://portal.crescent.com/sites/sales/" $ListName="Team Docs" $OutPutFile = "C:\LibraryFiles.csv" #Delete the file if exists If (Test-Path $OutPutFile) { Remove-Item $OutPutFile } #Write CSV headers Add-Content $OutPutFile "Root Folder, URL, File Name" #Get
Export Document Library File-Folder-SubFolder Structure to CSV Export Document Library File-Folder-SubFolder Structure to CSV Reviewed by Salaudeen Rajack on November 20, 2015 Rating: 5

How to Add Managed Metadata Column to SharePoint List using PowerShell?

November 20, 2015    , , , , , ,
Requirement: Add a Managed Metadata Column to SharePoint List using PowerShell. PowerShell Script to Add Managed Metadata Column in SharePoint List Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Variables $WebURL="https://portal.crescent.com/sites/Sales/" $ListName="Team Docs" $FieldName="Region" #Get the web and List $Web = Get-SPWeb $WebURL $List = $Web.Lists[$ListName] #Check if the column with same name exists in the list if(!($List.Fields.ContainsField($FieldName))) { #Get the Termset from Term store $TaxonomySession = Get-SPTaxonomySession -Site $web.Site $TermStore = $TaxonomySession.TermStores["Managed Metadata Service"] $TermGroup = $TermStore.Groups["Knowledge Portal"] $TermSet = $TermGroup.TermSets["Regions"] #Form the Taxonomy Field $TaxonomyField = $List.Fields.CreateNewField("TaxonomyFieldType", $TermSet.Name) $TaxonomyField.SspI
How to Add Managed Metadata Column to SharePoint List using PowerShell? How to Add Managed Metadata Column to SharePoint List using PowerShell? Reviewed by Salaudeen Rajack on November 20, 2015 Rating: 5

SharePoint Products Configuration Failed: Unable to create a Service Connection Point in the current Active Directory domain. Verify that the SharePoint container exists in the current domain and that you have rights to write to it.

November 17, 2015    , , , , , ,
Problem: After applying a service pack, Ran SharePoint Products Configuration Wizard. It failed with this error message: " An exception of type microsoft.sharepoint.postsetupconfiguration.postsetupconfigurationtaskexception was thrown. additional exception information: Failed to upgrade SharePoint Products. " Tried Running the PSconfig upgrade using command line, but that too failed: psconfig -cmd upgrade -inplace b2b -wait On scanning the log file it generated, found this error message: Unable to create a Service Connection Point in the current Active Directory domain. Verify that the SharePoint container exists in the current domain and that you have rights to write to it. Solution: Although, creating a service connection point container will resolve the problem, that require me to have Active Directory administrator rights! which is not possible In my case and we don't want to track SharePoint installations as of now! So, What's the solution? Run
SharePoint Products Configuration Failed: Unable to create a Service Connection Point in the current Active Directory domain. Verify that the SharePoint container exists in the current domain and that you have rights to write to it. SharePoint Products Configuration Failed: Unable to create a Service Connection Point in the current Active Directory domain. Verify that the SharePoint container exists in the current domain and that you have rights to write to it. Reviewed by Salaudeen Rajack on November 17, 2015 Rating: 5

How to Recover Credentials from Secure Store Service in SharePoint using PowerShell?

November 15, 2015    , , , , ,
So the previous SharePoint administrator left without documenting passwords from SharePoint secure store Service? Unfortunately, There is no way to get stored user name, passwords from SharePoint secure store service from Central Administration site. No worries, Lets use PowerShell to decrypt all user names and passwords stored in SharePoint secure store service. PowerShell script to Get Credentials from Secure Store Service:   Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Any web application associated with SSS proxy application or central admin $WebAppURL="http://intranet.crescent.com" #Establish the Context $Provider = New-Object Microsoft.Office.SecureStoreService.Server.SecureStoreProvider $Provider.Context = Get-SPServiceContext -Site $WebAppURL #Get All Target Applications $TargetApps = $provider.GetTargetApplications() foreach ($App in $TargetApps) { Write-Output $App.Name #Get the credentials for the App $Cre
How to Recover Credentials from Secure Store Service in SharePoint using PowerShell? How to Recover Credentials from Secure Store Service in SharePoint using PowerShell? Reviewed by Salaudeen Rajack on November 15, 2015 Rating: 5

Another component has already added an HTTPSessionState to the Context. Please make sure only one session state module should be registered

November 14, 2015    , , ,
Problem: After changing web application properties from SharePoint central administration site to support "anonymous access", sites started giving this error message: Another component has already added an HTTPSessionState to the Context. Please make sure only one session state module should be registered Solution: Open Web.config file of the SharePoint web application, search for  "SessionStateModule" , Make sure only one entry exists under sections such as <httpModules> and <modules> . Comment out any other additional entries!
Another component has already added an HTTPSessionState to the Context. Please make sure only one session state module should be registered Another component has already added an HTTPSessionState to the Context. Please make sure only one session state module should be registered Reviewed by Salaudeen Rajack on November 14, 2015 Rating: 5

People Search relevance is not optimized when the Active Directory has errors in the manager reporting structure - SharePoint 2013 Health analyzer error

November 14, 2015    , , , , , ,
Problem:  SharePoint 2013 Health analyzer logged this error - People Search relevance is not optimized when the Active Directory has errors in the manager reporting structure. Also in Windows Event Viewer, from MSSQL$SHAREPOINT Source, "An exception occurred while enqueuing a message in the target queue. Error: 15404, State: 11. Could not obtain information about Windows NT group/user , error code 0x534." Root Cause: There are user profiles in Active directory with no "Manager" property value defined (empty!). SharePoint uses this field for features such as to determine colleagues, social, people search relevance,etc. Solution: Set the Manager property value for all users who don't have it set! Here is the quick way to find a list of users who don't have Manager field: Import-Module ActiveDirectory Get-ADUser -Filter * | Where-Object {$_.Manager -Eq $Null} | Export-CSV D:\Profiles.csv -notype Alternatively, although its not a good idea, you ca
People Search relevance is not optimized when the Active Directory has errors in the manager reporting structure - SharePoint 2013 Health analyzer error People Search relevance is not optimized when the Active Directory has errors in the manager reporting structure - SharePoint 2013 Health analyzer error Reviewed by Salaudeen Rajack on November 14, 2015 Rating: 5

How to Delete a Master Page in SharePoint using PowerShell?

November 13, 2015    , , , , ,
Requirement: After deploying a new master page as part of new branding, We wanted to delete the old master page from all SharePoint sites. As we've applied the new master page, we don't want our existing custom master page to be appear in the master page gallery and master page selection page. Solution: PowerShell script to delete the SharePoint master page. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Site URL and Master page Name variables $WebURL="https://portal.crescent.com/sites/sales/" $MasterPageName="crescent.master" #Get Objects $web = Get-SPWeb $WebURL $MasterPage = $web.GetFolder("_catalogs/masterpage").Files[$MasterPageName] #Delete the Master page using PowerShell $MasterPage.Delete(); write-host "Master page deleted!" This PowerShell script just deletes given master page from the given web. Loop through each web and delete the master page from all. Remember, If the master page you
How to Delete a Master Page in SharePoint using PowerShell? How to Delete a Master Page in SharePoint using PowerShell? Reviewed by Salaudeen Rajack on November 13, 2015 Rating: 5

Add Attachment to List Item in SharePoint using PowerShell

November 08, 2015    , , , , ,
How to Add Attachment to a SharePoint List Item? To add attachment to SharePoint list item, Navigate to the list, select a list item  Click on "Attach File" button from the "Items" tab of the ribbon.  Browse and select the file to attach. Click OK to attach the file to item. You can also Edit the list item and then attach file. PowerShell to add attachment to sharepoint list item Here is the PowerShell script to add attachment to list item programmatically in SharePoint Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Custom Function to Add attachment to SharePoint List Item Function Add-Attachment($Item, $AttachmentPath) { $FileContent = [System.IO.File]::ReadAllBytes($AttachmentPath) $Item.Attachments.Add([System.IO.Path]::GetFileName($AttachmentPath), $FileContent) $Item.Update() Write-host "Attachment Added to List Item Successfully!" } #Variables $SiteURL="https://portal.crescent.com/sites/Dea
Add Attachment to List Item in SharePoint using PowerShell Add Attachment to List Item in SharePoint using PowerShell Reviewed by Salaudeen Rajack on November 08, 2015 Rating: 5

Copy Permission Levels in SharePoint using PowerShell

November 07, 2015    , , , , ,
Requirement : Copy permission level in SharePoint 2013 using PowerShell PowerShell to Copy permission level programmatically in SharePoint Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Configuration parameters $WebURL="https://portal.crescent.com" $SourcePermissionLevelName="Contribute" $TargetPermissionLevelName="Contribute without Delete" #Get the Source Permission Level $SourcePermissionLevel = $Web.RoleDefinitions[$SourcePermissionLevelName] #sharepoint copy permission level $TargetPermissionLevel = New-Object Microsoft.SharePoint.SPRoleDefinition($SourcePermissionLevel) #Remove "Delete" Base permission $TargetPermissionLevel.BasePermissions = "ViewListItems, AddListItems, EditListItems, OpenItems, ViewVersions, DeleteVersions, ManagePersonalViews, ViewFormPages, Open, ViewPages, CreateSSCSite, BrowseDirectories, BrowseUserInfo, AddDelPrivateWebParts, UpdatePersonalWebParts, UseClientIntegration, U
Copy Permission Levels in SharePoint using PowerShell Copy Permission Levels in SharePoint using PowerShell Reviewed by Salaudeen Rajack on November 07, 2015 Rating: 5

The password supplied with the username Domain\Username was not correct. Verify that it was entered correctly and try again.

November 07, 2015    , , ,
Problem: While trying to create a new web application from SharePoint 2013 central administration site, It gave this error message: Sorry, something went wrong The password supplied with the username Domain\Username was not correct. Verify that it was entered correctly and try again. Root Cause: This issue arises  when the SharePoint 2013/SharePoint 2010 farm account's password is expired or changed! Solution: Update SharePoint Farm Credentials! Here is how to update SharePoint 2013 farm credentials using STSADM tool: stsadm -o updatefarmcredentials -userlogin <UserAccount> -password <New-password>   E.g. stsadm -o updatefarmcredentials -userlogin Crescent\SP13Farm -password "Password-of-the-Account" Once you receive the message "Operation completed successfully.", Restart IIS!
The password supplied with the username Domain\Username was not correct. Verify that it was entered correctly and try again. The password supplied with the username Domain\Username was not correct. Verify that it was entered correctly and try again. Reviewed by Salaudeen Rajack on November 07, 2015 Rating: 5

How to Increase Distributed Cache Memory Size in SharePoint 2013?

November 07, 2015    , , , , ,
By default, the Distributed cache memory allocation size defaults to a value of 10% of total physical memory when SharePoint Server 2013 installs. The Distributed Cache service uses half of that memory allocation for data storage (also known as cache size, 5% cache size). You can change the memory allocation as it significantly affects the performance of the Distributed Cache service. Or you may want to change the memory allocation if you added more memory to your SharePoint servers after SharePoint is installed. Get Distributed Cache Memory Allocation size: To Get the current memory allocation of Distributed Cache, use: Use-CacheCluster Get-AFCacheHostConfiguration -ComputerName $env:computername -CachePort "22233" SharePoint 2013 distributed Cache is explained in my another article: Distributed Cache Service in SharePoint 2013 - Explained How to Change  Distributed Cache Memory Size in SharePoint 2013?   To Change distributed cache memory settings follow thes
How to Increase Distributed Cache Memory Size in SharePoint 2013? How to Increase Distributed Cache Memory Size in SharePoint 2013? Reviewed by Salaudeen Rajack on November 07, 2015 Rating: 5

Distributed Cache Service in SharePoint 2013 - Explained

November 06, 2015    , , , ,
What is Distributed Cache in SharePoint 2013: The SharePoint Distributed Cache service is an additional caching mechanism introduced in SharePoint 2013 to support beyond the options that already exist (such as Object Cache, BLOB Cache, and Page Output Cache) from the earlier versions of SharePoint. Distributed cache enables to quickly retrieve data without any dependency on SQL databases, as everything is stored in memory. The Distributed Cache service provides caching services for several features in SharePoint Server 2013. Some of the features that use the Distributed Cache service include: News feed Authentication OneNote client access Security Trimming Page load performance How to Install SharePoint Distributed Cache? The good news is: You don't have to do anything to get distributed cache service features! When you install SharePoint 2013, distributed cache gets installed and configured automatically! The Distributed Cache service is built on Windows Server AppFab
Distributed Cache Service in SharePoint 2013 - Explained Distributed Cache Service in SharePoint 2013 - Explained Reviewed by Salaudeen Rajack on November 06, 2015 Rating: 5

Create My Site for All Users in SharePoint using PowerShell

November 03, 2015    , , , , ,
SharePoint My Sites are automatically created when the first time users click on the My Content link in welcome menu. However, To promote the usage of SharePoint social, we deiced to pre-create SharePoint My sites for all users. Create Mysite for All Users in SharePoint using PowerShell Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue Function Create-MySite($MySiteHost, $UserAccount) { #Get Objects $ServiceContext = Get-SPServiceContext -site $MySiteHost $UserProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext) #Check if user Exists if ($UserProfileManager.UserExists($UserAccount)) { #Get the User Profile $UserProfile = $UserProfileManager.GetUserProfile($UserAccount) #Check if User's My site is Cretaed already if($UserProfile.PersonalSite -eq $Null) { $UserProfile.CreatePersonalSite() write-host "
Create My Site for All Users in SharePoint using PowerShell Create My Site for All Users in SharePoint using PowerShell Reviewed by Salaudeen Rajack on November 03, 2015 Rating: 5

Open Documents in Client Application Instead of Browser

November 01, 2015    , , , , ,
Requirement: Enable Microsoft Word documents, Excel Spread sheets and PowerPoint Presentations to open in client applications like Microsoft Word, Excel and PowerPoint instead of opening them in browser directly. Solution:  In SharePoint 2013, you can enable open document in applications by configuring an option in document library settings. Navigate to the Library >> Click on "Library Settings" from the Ribbon Under General Settings, Click on "Advanced Settings" link Under "Opening Documents in the Browser", choose "Open in the client application" Click "OK" to save your changes.  Activate "Open Documents in Client Applications by Default" Feature: While the above setting sets the document opening behavior at the specific document library, we've a built-in SharePoint 2013 feature called "Open Documents in Client Applications by Default" to control this behavior at site collection level.  To
Open Documents in Client Application Instead of Browser Open Documents in Client Application Instead of Browser Reviewed by Salaudeen Rajack on November 01, 2015 Rating: 5

How to Make Attachments Mandatory in SharePoint List?

November 01, 2015    , , , , ,
Requirement: In a SharePoint list, make attachment required field! Solution: While, creating a Document library with metadata columns is one option, requirement is only to make the attachments mandatory in SharePoint list forms. To make attachment mandatory in SharePoint list we can use simple JavaScript. Add content editor or script editor web part on "NewForm.aspx" just below SharePoint list form web part, and then place the below code in it! JavaScript to make attachments mandatory: <script type="text/javascript" language="javascript"> function PreSaveAction() { if (document.getElementById('idAttachmentsRow').style.display=='none' ) { alert('Attachment is Mandatory! Please attach Documents.'); return false ; } else { return true; } } </script> and here is the script in action:
How to Make Attachments Mandatory in SharePoint List? How to Make Attachments Mandatory in SharePoint List? Reviewed by Salaudeen Rajack on November 01, 2015 Rating: 5
Powered by Blogger.