Pages

Thursday 2 May 2019

SharePoint Rest api JSON Result return one day before date.


SharePoint Store the date& time Field as UTC format , when we retrive the datatime flied it will return as UTC format,

i use moment.JS to convert date & time , you can download from https://momentjs.com/

download the moment.js and add the reference Js or any file where your fetching this date.


<script type="text/javascript" src="/path to Jquery/jquery-1.12.2.min.js"></script>
<script type="text/javascript" src="/path to Momentjs//moment.js"></script>

var StartTime= (item.ProgramStartDate);
console.log("Date Before Conversion: " +StartTime );

 StartTime= moment(StartTime).format('DD-MM-YYYY');
console.log("Date Before Conversion: " + StartTime);

Result will be like below.

I use dd-mm-yyyy Format. there are many other formats are available in momentjs.



SharePoint Search Service error : Could not connect to the search administration Web service on server SPSWAPP01 because the web server is not running.

SharePoint Search is not working  .

Logged in to SharePoint server and open Central administration  -> Service applications -> Click on Search Service application :



You will notice there is an error : Could not connect to the search administration Web service on server SPSWAPP01  because the web server is not running.

Open command prompt as administration and run the below command.
net start spsearchhostcontroller

Restart the IIS and with cmd iisreset

open search service application from Console. and check the status.



Friday 22 March 2019

SharePoint designer workflow error : Errors were found while compiling the workflow


During Publishing the Workflow using SharePoint designer getting an error.

(-1, -1) Type System.CodeDom.CodeBinaryOperatorExpression is not marked as authorized in the application configuration file.)
(0, 0) Activity 'ID807' validation failed: Property "Condition" has invalid value. Condition expression is invalid. The condition expression can not be null.)


this is happened due to security update in SharePoint.

" .NET security updates for CVE-2018-8421"

Solution


The solution is to explicitly add the necessary types to all web applications' web.config files.

For SharePoint 2013 and later versions

Open web.config and find a section :

  <System.Workflow.ComponentModel.WorkflowCompiler>
    <authorizedTypes>
      <targetFx version="v4.0">  

For SharePoint 2013 and later versions, add the following lines:
<authorizedType Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodeBinaryOperatorExpression" Authorized="True" />
<authorizedType Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodePrimitiveExpression" Authorized="True" />
<authorizedType Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodeMethodInvokeExpression" Authorized="True" />
<authorizedType Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodeMethodReferenceExpression" Authorized="True" />
<authorizedType Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodeFieldReferenceExpression" Authorized="True" />
<authorizedType Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodeThisReferenceExpression" Authorized="True" />
<authorizedType Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodePropertyReferenceExpression" Authorized="True" />

For SharePoint versions earlier than SharePoint 2013

For SharePoint versions earlier than 2013, add the following lines instead:
<authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodeBinaryOperatorExpression" Authorized="True" />
<authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodePrimitiveExpression" Authorized="True" />
<authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodeMethodInvokeExpression" Authorized="True" />
<authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodeMethodReferenceExpression" Authorized="True" />
<authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodeFieldReferenceExpression" Authorized="True" />
<authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodeThisReferenceExpression" Authorized="True" />
<authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" NameSpace="System.CodeDom" TypeName="CodePropertyReferenceExpression" Authorized="True" />


Thursday 18 October 2018

Managed Metadata terms changes display name is reflecting . Taxonomy Update Scheduler is not working

I am using Terms in list publish using Managed metadata services. I required to do Change certain terms . its Changed successfully.

I open the list where i am using it , its update as display only, when i use custom code to fetch the term its still showing the previous name. 

i verify the Taxonomy Update Scheduler from timer services , its running without any error, but somehow its not updating the values.

There is hidden list for taxonomy  that is need being update automatically, 

Need to update the Hidden list using powershell with below script.

$siteUrl = "http://devvmspap01:15734/"
$site = Get-SPSite $siteUrl
[Microsoft.SharePoint.Taxonomy.TaxonomySession]::SyncHiddenList($site)
$site.dispose()


Wednesday 17 October 2018

Migrate SharePoint SiteCollections from one farm to another farm using Content Database

SharePoint Site collection can be moved to another farm or location using site collection backups or Content database back up.

If you required only one sitecollection then we can backup site collection using powershell or SharePoint central admin.

in my cases i have 2 site collection in one web application and both are using same content database.

I use Content database method.

Step 1 : backup Content Database from SQL Server.


Step 2: Restore Content database to new SQL Server (new Loction)
 








Step 3: Mount-SPContentDataBase
           
if you don't have existing web application please create new web application  and mount your database to web application, it will use the same managed path as you have in original location.

Mount-SPContentDatabase "WSS_Content_MyDB" -DatabaseServer "DEVVMSPDB01\SP2013DB" -WebApplication http://devvmspap01:15734/

SharePoint Database Log file is increase. (Shrink the SharePoint database Log file)


SharePoint Log files are Increase more then database file or some time increased more then it, 
Easy way is to reduce the log size using  Shrink the Log file.


-- Set database to simple
ALTER DATABASE WSS_Conten_MyDB
SET RECOVERY SIMPLE; 
GO 


-- 1st parameter is Database Log File name , 2nd parameter is new log Size in MB (100 MB)
DBCC SHRINKFILE (WSS_Conten_MyDB_Log, 100); 
GO 


-- Reset the database recovery model to full
ALTER DATABASE WSS_Conten_MyDB
SET RECOVERY FULL; 
GO 


Friday 4 May 2018

SharePoint 2013 Audit Log Report , Error , Report Contains no data.


SharePoint 2013 Audit log report contains no

Sorry, something went wrong

Report contains no data.



Reason :

Resolution :

Go to Site Settings and Set the Site collection audit settings.

 


Click on Site Collection Audit Settings. and Set the settings


Try to Regenerate the Report. and it will work.

Friday 27 April 2018

Get All items in SharePoint List Using PowerShell


Get All items from List or Library Using Power Shell.

# Add below Reference if your using Power shell ISE  
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

# Web Url
 $WebUrl="https://My web/"
 $Web = Get-SPWeb -Identity $WebUrl

# List Name
 $ListName ="PROJECT MANAGEMENT"

# Try to get List
 $List = $web.Lists.TryGetList($ListName)

#Get Count of Items
 Write-Host "  No of item: " $list.Items.Count 
 foreach($Item in $list.Items)
 {
   # Here you can iterate Item , Such as i required URL for Each item
    Write-Host $Item.Url
 }

or 

 $WebUrl="https://cdms.pr1ma.my/dev1/jhr/P-JHR-2014-00073"
 $Web = Get-SPWeb -Identity $WebUrl
# Get List Name
 $ListItems = $Web.lists["PROJECT MANAGEMENT"]
#Get Formated Resutls

 $ListItems.items | format-table -property title,url

Wednesday 25 April 2018

Get All Site Collections & all Site in Web application using Powershell

How to Get all site Collections in SharePoint Web Application


Add-PSSnapIn "Microsoft.SharePoint.Powershell"
$SiteCollection= get-spsite -limit all -WebApplication https://Server

foreach($Site in $SiteCollection)
{
    foreach($web in $Site.AllWebs)
       {
        Write-Host $web.url
      }
     
}

More details: https://docs.microsoft.com/en-us/sharepoint/sites/view-all-site-collections

Monday 26 March 2018

Site Collection Restore failed : InvalidData: (Microsoft.Share...dletRestoreSite: SPCmdletRestoreSite) [Restore-SPSite], DirectoryNotFoundException

Site-collection restore failed with below error

Restore-SPSite : 0x80070003 At line:1 char:1 + Restore-SPSite SiteURlTarget -Path C:\Backup\2018.bak -For ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ + CategoryInfo : InvalidData: (Microsoft.Share...dletRestoreSite: SPCmdletRestoreSite) [Restore-SPSite], DirectoryNotFoundException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreSite 


Cause: Database is not upgrade after installation of updates. 
Steps to resolves: 
1.       Upgrade the Database with below command. Upgrade-SPContentDatabase WSS_Content_DB


2.       Take the backup of collection   Backup-SPSite http://server:9999/source  -Path C:\Backup\myBackup2018.bak  

3.       Restore the backup.   Restore-SPSite http://server:9999/Target -Path C:\Backup\myBackup2018.bak

Tuesday 16 August 2016

SharePoint 2013 logical architecture Overview



 



SharePoint Farm,

SharePoint farm is one or collection of more servers connected through same configuration database. You can configure on one server or you can divide the roles such WFE, APP server, indexing or can define server for specific role.

Single server deployment use only for development or evaluation purpose where we can install everything on one server

2 tier refers to database and Sharepoint server, where we can have one database server to host the SQL server for Sharepoint databases and other server is used for SharePoint.

3 tier refer to WFE, Application server and Database server.

Service applications.

Service applications provides specific functionality to web applications such as User Profile service application (manage user profiles), Search service application, manage Meta data service application, and excel etc. we can associate out desire service application with Sharepoint web application. And each service application contains the proxy which manage the connections to each association or web application.

Web Application.

Web application is upper boundary of implementation, SharePoint central administration allows you to create new web application and IIS will host that web application such as http://portal.eteam.local, one web application can contains many site collections, which runs under same url, on web application level we can define AAM alternate access mappings which enables multiple urls for one application. Each web application have separate application pool in IIS.

Site collection.

Site collection is nothing except the logical container inside the web application, we can define multiple site collection under one web application and we have option to separate content database for each site collection. Each site collection have separate administration and permissions.

There is no hierarchy between sites collections, each of them have separate. Each site collection have its own security boundary

Top level sites and sub sites

When you defines site collection, top level site is created, first site is known as top level and rest of site are created under top level, it will maintain the hierarchy, its built like a tree, you can carry the same permissions known as inherit the permissions or you can break the permission for any site where ever you want.

List and libraries  

Under the sites we have list and libraries to save the data, libraries refer to documents and list refer to structured data in form of rows and columns. SharePoint provides many types of lists and libraries such as task list, Announcements, Contacts, Discussion boards, Calendar, Project tasks, Issue tracking and Survey etc.

SharePoint 2013 provide many predefine libraries such as Document library, Asset library, Dashboards libraryData Connections library, Form library, Picture library, Wiki Page Library and Pages Library

SharePoint Configuration Database

SharePoint Configuration database is created while you’re going to configure SharePoint farm, it contains the information such as other Sharepoint databases, IIS Web sites, Web applications, and Trusted or farm based solutions, web parts, and site templates

Default named as SharePoint_Config,

SharePoint Content Databases

All information related to site collection is store in content database, information such as All documents in document libraries, List data, web parts and their customization or properties, user or sand box solutions,

Friday 12 August 2016

SharePoint 2013 Service application and overview


SharePoint 2010 introduces new service application model, which continues in Sharepoint 2013, Service application model is very flexible,
  • Host the required service application. If you need only search just configure search service application
  • At web application level service association is also very simple, associate your required service application with web application.
  • You can create multiple instance of service application.
  • Some service applications have their own one or more databases to save the configuration and other related data. Such as User profile have profile, synchronization, and social tagging databases





1)      Business connectivity service application
Its enable to connect with external data sources, you can perform CRUD and query operation on external data. To create connection you can use Sharepoint designer and Visual studio (custom connector).

2)      Manage Meta data service application
       This service application enables you to manage taxonomy hierarchies, keywords, and social tagging features of SharePoint 2013. You can create groups, term sets and terms.

3)      Performance point service application
This services application or feature only available in enterprise version of Sharepoint , it enable the BI features , performance point designer is free tool to create dashboard , scorecards charts etc. and you can interact with Sharepoint lists, SQL server databases to create the dashboards.

4)      Search service application
             Its enables the capabilities to crawl the data based on sources you define in Sharepoint    
             search configuration and it index the data to respond the end user, search have following
             basic components Search crawler, Content processing, Index , query .
Search application contains its own databases

·         Search administration DB
·         Analytics reporting database DB
·         Crawl Store DB
·         Link DB

5)      User Profile service application
Enable to fetch user profiles of the users, you can use this data as User Profile hosting at my site, you can create audiences which helpful to filter contents, you can Host my site and each can have its own my site. Also provide the features related to social tagging and Notes.
User Profile service contains following databases

·         Profile DB
·         Synchronization DB
·         Social Tagging DB

6)      Excel service
This service enable the interaction to excel files using Browser.

7)      Visio services
              Its helps to view m interact and refreshing the Visio diagram in browser.

8)      Access services
Enable to interact with Access 2013 client or using the browser to create, view edit operations.

9)      Word automation services.
It used to view and edit the word documents in browser and also used for document conversion.

10)   App management service application
New Service application in Sharepoint 2013, Manage the Apps for SharePoint internal App Catalog and Public Sharepoint Store.

11)   Machine translation service application
New Service application in SharePoint 2013, Manage the Automatic translation for sites and contents.

12)   Work automation service application
New service application in SharePoint 2013, this service manage aggregation of Task for user at central location.

Thursday 11 August 2016

SharePoint 2013 features overview part 1


SharePoint 2013 is consider to be new way of working together. SharePoint in simple “Share Point “ Just divide into 2 words, its Point or central location to share your ideas, moreover you can organize the contents, discover (search) and manage the contents. Share the knowledge and distribute to other personnel in teams and organization.
Its product with lot of features called out of the box features, IT professional can manage the information based on customers’ requirements, developers can extent the out of the box features and designer can build new eye catching designs.

·         New authentication, classic mode authentication is no longer available in Sharepoint 2013, only claim based authentication is available. And there are lot improvements in it and allows server to server and app authentication in Sharepoint 2013.
·         Business connectivity services provides a way to connect using oData, previously only using web service (WCF), SQL and custom using .Net.

·         Added new video content type to manage the videos. Easy to display videos on the pages.

·         Thumbnail preview images are create automatically as you upload the video into Sharepoint library.

·         SharePoint 2013 allows you add iframe inside HTML field on the page.

·         It allows you to create image rendition. Which helps to show different sized images on different pages. Image Renditions feature is available under the site settings

·         Variations for multilingual sites SharePoint 2013 having a new service called machine translation service.

·         Cross site publishing manages the reuse the contents across multiple site collections.

·         SharePoint 2013 added new concept of Catalog enabled list and libraries, its type of list storing information that can publish across the sites collections, contents from catalog has been crawled and become part of search index and can display using content search web part.

·         Design manager is new feature only for publishing sites in Sharepoint. You can convert html design to Sharepoint master page. You can import & export design package.

·         Device channels allow you to manage design for different devices by creating different channels for different devices. By assigning different design to different channel.

·         Office web app, is now available as separate server and we can create office web server as farm and need to do binding with Sharepoint server, at the same time office web app can use with Lync and exchange.

·         Fast search is no more. Search architecture is changed and there are lot enhancements in it please see the details for search service Sharepoint 2013.

·         New Workflow engine , there is new Sharepoint workflow engine for Sharepoint 2013 build on base of windows workflow manger 4.5, if you install Sharepoint 2013 and did not install and configure Sharepoint 2013 workflow manager you will only experience Sharepoint 2010 workflows which is installed automatically with Sharepoint 2013.

·         New service applications

o    App Management service application is new service application use to manage app available in form, permissions, and app licenses  
o   Machine translation service is new service application used for variation of sites and provide automated translation of Sharepoint contents
o   Work management service application is new service application, Sharepoint 2013 provide great feature of single view all assigned task to person, it integrate assigned task from sites , exchange and project service.

Thursday 24 March 2016

SharePoint 2013 FBA (Form Base Authentication) Configuration

SharePoint 2013 Configured Form Based Authentication using SQLMemberShipProvider.
You need to configure SQLMemebershipProvider as Users Database and then you need to do some changes in Sharepoint Central administration web.config, Your Webapplicaiton and Security Token Service.

1.     Configured SQL MembeShipProvider.

  1. Login to SQLserver.
  2. Go to following path  ->  C:\Windows\Microsoft.NET\Framework64\v4.0.30319
  3. Find the aspnet_regsql.exe, run that exe to configure membership Database.






Verify the Permissions

Open IIS on Sharepoint 2013 and open Pool (Security Token Service), see the Pool account user name . 
that user Must have full access to the database, Please follow the permission settings from below screen.
to Add new user right -> click on Users for that particular Database for Existing user select and given permissions.




2.     SharePoint 2013 Central Administration WEB.Config Changes.

  •          Open IIS   à
  •          Right click on Central Administration web application -à
  •          Click  on  Explore
  •          Very Important thing, you must have to backup Web.config
  •          Right Click and open the web.config
  •           Find the membership Section.

And replace with below lines.
<membership  defaultProvider="FBAMemberShipProvider">
      <providers>
            <add name="FBAMemberShipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="AltranExtranet" enablePasswordReset="true" enablePasswordRetrieval="false" passwordFormat="Hashed" requiresQuestionAndAnswer="false"
       requiresUniqueEmail="true" applicationName="/" />
      </providers>
    </membership>
Fine the Rolemanager
<roleManager defaultProvider="AspNetWindowsTokenRoleProvider" enabled="true" cacheRolesInCookie="false">
      <providers>
             <add name="FBARoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral,
        PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="FBAConStr" applicationName="/" />
      </providers>
    </roleManager>

Go at the end of Web.config and add connection string

<connectionStrings>

       <add name=" FBAConStr " connectionString="Data Source=SQL2012;Initial Catalog=FBAUSERSDB;Integrated Security=SSPI" />

</connectionStrings>


Find PeoplePickerWildCards and add your membership provider as key.

<add key=" FBAMemberShipProvider" value="%" />

3.     Web application WEB.Config Changes

·         Your web application must be Enable Forms Based Authentication (FBA)

·         Open IIS   à
·         Right click on Central Administration web application -à
·         Click  on  Explore
·         Very Important thing, you must have to backup Web.config
·         Right Click and open the web.config
·         Open Membership Section and add New MembershipProvider, web application have one exiting and default membership Provider

<add name="FBAMemberShipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="AltranExtranet" enablePasswordReset="true" enablePasswordRetrieval="false" passwordFormat="Hashed" requiresQuestionAndAnswer="false"
       requiresUniqueEmail="true" applicationName="/" />

Fine the Rolemanager
<roleManager defaultProvider="AspNetWindowsTokenRoleProvider" enabled="true" cacheRolesInCookie="false">
      <providers>
             <add name="FBARoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral,
        PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="FBAConStr" applicationName="/" />
      </providers>
    </roleManager>

Go at the end of Web.config and add connection string

<connectionStrings>

       <add name=" FBAConStr " connectionString="Data Source=SQL2012;Initial Catalog=FBAUSERSDB;Integrated Security=SSPI" />

</connectionStrings>

Find PeoplePickerWildCards and add your membership provider as key.

<add key=" FBAMemberShipProvider" value="%" />

4.     Security Token Service WEB.Config Changes

  •          Open IIS   à
  •          Right click on Central Administration web application -à
  •          Click  on  Explore
  •         Very Important thing, you must have to backup Web.config
  •         Right Click and open the web.config
  •         Find the membership Section.


<membership  defaultProvider="FBAMemberShipProvider">
      <providers>
            <add name="FBAMemberShipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="AltranExtranet" enablePasswordReset="true" enablePasswordRetrieval="false" passwordFormat="Hashed" requiresQuestionAndAnswer="false"
       requiresUniqueEmail="true" applicationName="/" />
      </providers>
    </membership>

Fine the Rolemanager

<roleManager defaultProvider="AspNetWindowsTokenRoleProvider" enabled="true" cacheRolesInCookie="false">
      <providers>
             <add name="FBARoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral,
        PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="FBAConStr" applicationName="/" />
      </providers>
    </roleManager>

Go at the end of Web.config and add connection string


<connectionStrings>
       <add name=" FBAConStr " connectionString="Data Source=SQL2012;Initial Catalog=FBAUSERSDB;Integrated Security=SSPI" /> 
</connectionStrings>


That’s IT ..

How to do testing.

  1.  You can down FBA pack for SharePoint 2013 at CodePlex  Download FBA Pack, follow the instruction given there and create user and test the logins 
  2. Create web application is Visual studio and open web.config.

 a.       Open web.config add Role in Section.


<add name="FBARoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral,
        PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="FBAConStr" applicationName="/" />

b.      Add membership provider and membershipsection.


<add name="FBAMemberShipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="AltranExtranet" enablePasswordReset="true" enablePasswordRetrieval="false" passwordFormat="Hashed" requiresQuestionAndAnswer="false"
       requiresUniqueEmail="true" applicationName="/" />

c.       Add connection string


<connectionStrings>
        <add name=" FBAConStr " connectionString="Data Source=SQL2012;Initial Catalog=FBAUSERSDB;Integrated Security=SSPI" />
 </connectionStrings>

Create a page and add Createuser Wizard
Open the particular page in browser and create User.