Pages

Thursday, 20 February 2020

SharePoint Designer 2013 : There is a problem with your account please try again later

I had the same problem and it was related to two-factor authentication. 
I solve it by generating app password on page https://portal.office.com/account
When you generate this unique password phrase then just use it instead you original password it will work.

Reference link: https://docs.microsoft.com/en-us/azure/active-directory/user-help/multi-factor-authentication-end-user-app-passwords

Thursday, 9 November 2017

How to Configure SharePoint 2013 Extended Web Application to Trust ADFS using PowerShell

Export this ADFS token signing certificate to all SharePoint server(s)

ADFS Token signing certificate must be exported from ADFS server and used while creating trust in SharePoint Server. Here is how:

   a.From ADFS console, Expand "Certificates" folder, Right Click on your ADFS token signing
   b.certificate and choose "View Certificate".
   c.Under the "Details" tab, Click on "Copy to file" button.
   d.For Export Private key section, choose "No, do not export the private key"
   e.Click "Next". Choose export file format as "DER Encoded binary x.509 (.CER)"
   f.This will export the certificate from ADFS.

Configure SharePoint 2013 to Trust ADFS

Let’s create a trusted identity token issuer pointing to ADFS as the claims provider, using PowerShell

#Register the Token Signing certificate from ADFS Server to establish Trust between SharePoint and ADFS server
$Cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("F:\Raja\externalADFS.cer")

#Map the claims attributes
$emailMap = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" -IncomingClaimTypeDisplayName "EmailAddress" -SameAsIncoming

$upnClaimMap = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn" -IncomingClaimTypeDisplayName "UPN" -SameAsIncoming

$RoleClaimmap = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" -IncomingClaimTypeDisplayName "Role" –SameAsIncoming

$realm="urn:portal.world.com"

#Sign-in URL will be ADFS Server instance
$signInURL="https://external.world.com/adfs/ls/"

#Create new trusted identity token issuer
$ap1 = New-SPTrustedIdentityTokenIssuer -Name “ISS Portal Claims” -Description “ISS with Claims Authentication using ADFS 3.0 on Sharepoint 2013” -realm $realm -ImportTrustCertificate $cert -ClaimsMappings $upnClaimMap,$emailMap,$RoleClaimmap -SignInUrl $signInURL -IdentifierClaim $emailmap.InputClaimType

IISReset


The first two lines of the above code, registers the certificate in SharePoint certificate store. Moreover, You may have to do this for Root Certificate Authority as well. You can see them under "Manage Trusts" link in security section of central administration.

Realm - is a identifier which helps ADFS to load respective configuration for a particular profile. which uses the convention of: urn:yourwebapp:yourdomain (can be anything, technically. It just uniquely identifies between multiple web applications)

IdentifierClaim - is the unique ID that identifies users in SharePoint. So,when users logged in via ADFS, they'll be identified by Email id in this case. Also, when granting access to SharePoint sites from ADFS, we'll have to use this identifier as user names. Make sure that the mapped claims exists in the source. E.g. If E-mail is mapped as Identifierclaim, then It must be exists in AD. In other worlds, E-mail field must contain a value, shouldn't be null!

SharePoint 2013 ADFS with multiple web applications 
So, You have established trusted identity provider for your primary web applications, and all other  web apps as well, say for e.g. My sites. Now, You'll have to add them in your trusted identity provider with this PowerShell code:

$ap = Get-SPTrustedIdentityTokenIssuer "ADFS Portal Claims"
$uri = new-object System.Uri("https://portal.world.com")
$ap.ProviderRealms.Add($uri, "urn:portal.world.com")
$ap.Update()

Register ADFS to newly Creating Extended Web Applications

$ap = Get-SPTrustedIdentityTokenIssuer -Identity "ADFS Portal Claims"
Write-host "Creating Extended Extranet WebApplication" -foregroundcolor "magenta"
Get-SPWebApplication -Identity http://test.portal.world.local | New-SPWebApplicationExtension -Name "test.portal.issworld.com - https" -SecureSocketsLayer -Path "C:\inetpub\wwwroot\wss\VirtualDirectories\test.portal.world.com443" -HostHeader "test.portal.world.com" -Zone "Intranet" -URL "https://test.portal.world.com" -Port 443 -SignInRedirectURL "/_trust/default.aspx"  -AuthenticationProvider $ap
Write-host "Extended Extranet WebApplication Created" -foregroundcolor "magenta"

What is ADFS and How the ADFS - SharePoint authentication process works?

Active directory federation services are the solution for extending enterprise identity beyond corporate firewall. It simplifies sharing identities between trusted partners across organizations. It’s a common requirement in a typical business scenario, users in one organization wants to access a secured application/website from an another organization. Without ADFS, we'd end-up re-creating user logins for the partner company in our AD. But that introduces the problem of maintaining and managing two separate identities for the partner company users. Here is where ADFS comes to the picture. It solves the problem by federating identities and establishing single sign-on capability. SharePoint 2013 - ADFS integration is seamless as its natively supported.

Generally, in SharePoint world, ADFS is used in these three scenarios:

     a. Domains which are not part of your AD forest (Such as acquired companies without trusts established, with network connectivity between them in place): User in one organization accesses an application in another organization, so that you can collaborate across organizational boundaries. Say for E.g. Your company is running an internal SharePoint site/application and your partner company/acquired company wants to make use of the same.  across organizational boundaries without duplicating user logins.

     b. Extranet setups for partners/customers - Accessing SharePoint application via the Internet, which extends the first scenario to include remote Internet access who are outside the organization. The external domain is still responsible for validate provided credentials and pass it on the SharePoint.

     c. Office 365/Cloud - You are running a SharePoint farm either in Cloud or in Office 365 and want to provide access to the users of your company without re-creating their identities in the cloud.

How the ADFS - SharePoint authentication process works?

   1. User types SharePoint site URL and picks the relevant authentication provider from the sign-in page.
   2. SharePoint redirects to the respective ADFS server configured already, User promoted for credentials.
   3. ADFS handles the authentication by Verifying the provided user name and password from the identity provider – AD.
   4. ADFS creates a Token, Signs and puts it in a cookie. Redirects to SharePoint with that cookie.
   5. SharePoint STS validates and extracts the claims from the token.
   6. SharePoint performs authorization and connects the user to the web application.

Wednesday, 8 November 2017

How to get SharePoint Farm Content Inventory report using PowerShell Script

      Today, in this article we are going to see How to get SharePoint Farm Content Inventory report using PowerShell Script.

This script is comprised of several functions that will collectively inventory content within a SharePoint 2007, 2010, and 2013 farm and generate CSV files that detail the web apps, site collections, webs, lists, and Content Types.  The script will also output groups, unique permisisons at various scopes, workflow associations, etc.

Note that the destination folder should not be your system drive and needs to have enough free space on the disk to accomodate the CSV files (I've seen some large environments generate 2GB of logs).  Also, if you wish to clear prior logs, you can include the -ClearPriorLogs switch.

How to run the below PowerShell script

  1. Copy and paste entire script into 'SharePoint 2013 Management Shall'
  2. Run this command Run-FullInventory -LogFilePrefix "SP2013SP1_SPFarmInventoryReport" -DestinationFolder      "C:\temp\InventoryReport"

Click here to download PowerShell Script


Friday, 3 November 2017

how to find out how may documents are in your document libraries on a particular SharePoint site

Today, in this article we are going to see how to find out how may documents are in your document libraries on a particular SharePoint site? You can use this script to point to a particular site, or even the root site, and get that information quickly and easily.

1. Download the script and save as Get-SPDocumentCount.ps1
2. Edit the file and change the PARAM section and change $RootSite to the root URL of your SharePoint site.
3. Edit $ReportPath to where you want the script to save your report and save the file.

** IMPORTANT **
Script must be run on your SharePoint server.


Script:

[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges({
Param (
    [Parameter(Mandatory=$true)]
    [string]$Site,
    [string]$RootSite = "https://test.portal/lobalcr/eam",
    [string]$ReportPath = "c:\reports"
)
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$Webs = Get-SPWeb -Site $RootSite -Filter { $_.Template -like "*" } -Limit ALL | Where { $_.URL -like "$Site*" }
$Result = @()
ForEach ($Web in $Webs)
{   ForEach ( $List in $Web.Lists )
    {   $Result += New-Object PSObject -Property @{
            'Library Title' = $List.Title
            Count = $List.Items.Count
            'Site Title' = $Web.Title
            URL = $Web.URL
            'Library Type' = $List.BaseType
        }
    }
}
$Result | Select 'Site Title',URL,'Library Type','Library Title',Count | Export-Csv "$ReportPath\SPListReport.csv" -NoTypeInformation
});

Thursday, 2 November 2017

how to add a user with full control rights on multiple SharePoint site collections from import .csv file using power shall script

Today, in this article we are going to see how to add a user with full control rights on multiple SharePoint site collections from import .csv file using power shall script

1. Adding ADFS account users to site collection

[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges({
$csv=import-csv C:\SiteCollectionUrls.csv
foreach($site in $csv){Set-SPUser -Identity 'i:05.t|adfs claims|user@email.com' -Web $site.Site -AddPermissionLevel "Full Control"}
});

2. Adding windows account users to site collection

[Microsoft.SharePoint.SPSecurity]::RunWithElevatedPrivileges({
$csv=import-csv C:\ SiteCollectionUrls.csv
foreach($site in $csv){Set-SPUser -Identity ' i:0#.w|domain\userid' -Web $site.Site -AddPermissionLevel "Contribute"}

});

Hope it helps you.

Friday, 10 October 2014

Top 50 SharePoint Sites

The Top 50 SharePoint Sites:
As SharePoint continues to grow in popularity within organizations large and small, the number of SharePoint related online resources has skyrocketed.

Wednesday, 1 October 2014

SharePoint 2010's Content Query Web Part(CQWP)

The Content Query Web Part is one of three Web Parts provided by SharePoint 2010's publishing sites to display content. The Content Query Web Part allows you to display content from anywhere in your site collection; it’s useful for rolling up content to a home page or creating an archive view of content.
The Content Query Web Part is commonly used to display a list of news articles on a site’s landing page(the first page visitors usually arrive at). Say you have three people creating new articles in your site. You can use the Content Query Web Part to automatically display a list of these articles on your department’s landing page.

The CQWP: What does it do and where can I find it?


The CQWP is an out of the box webpart that, as stated above, enables you to aggregate data. We need aggregation over multiple libraries and we need filtering. Before this little 'gem' makes its appearance, you need to enable it. This is done via the activation of the publishing infrastructure feature.
2013-09-06-SharePointCQWP-02.png
Follow these steps to use the Content Query Web Part:
  1. Insert the Content Query Web Part into your page and edit the Web Part’s properties.
    The Content Query Web Part is located in the Content Rollup section.
  2. In the Query section of the Web Part, select the options that will return the items you wish to see in the Web Part.
    image0.jpg
    The Query section provides many options, including:
    • Source: Select the location in your site hierarchy where you want to query items. If you want to display items regardless of where they appear in your site hierarchy, select the Show Items from All Sites in This Site Collection radio button and select the List Type, Content Type Group, and Content Type you want to display.
      For example, if you want to roll up all project tasks, use your Tasks List Type and List Content Type Group and Task Content Type.
    • List Type: Select the kind of list that stores your items from the drop-down list.
    • Content Type: Select the content type group and content type you want to use for query from the drop-down lists.
    • Audience Targeting: If you want the Web Part to honor any audience targeting settings on the items, select the Apply Audience Filtering check box.
    • Additional Filters: Include any additional fields on which you wish to filter by selecting from the drop-down lists. The list of available fields is determined by the list type and the content type.
      For example, to display all tasks that aren’t started, choose Task Status, Is Equal To, and Not Started from the drop-down lists.
      You can configure more query options for the Content Query Web Part with SharePoint Designer 2010.
      Behind the scenes, this Web Part generates a query with SharePoint’s query language, CAML (Collaborative Application Markup Language). You can write your own custom CAML query to use instead of selecting the options; you can find sites that tell you more about CAML by searching “CAML syntax” in your favorite search engine.
  3. In the Presentation section of the Web Part, select the options that will display your items.
    image1.jpg
    • Grouping and Sorting: Select the columns by which you wish to group results in the Group Items By drop-down list. You can also choose to group results by site by selecting the Site option in the Group Items By drop-down list.
      You can select a column to sort by and limit the number of items displayed by choosing the Sort Items By drop-down list and selecting the Limit the Number of Items to Display check box, respectively, and then entering a number in the Item Limit field.
    • Styles: Select the group style and item style you want to use to display your items from the Group Style and Item Style drop-down lists.
      These styles determine what information appears. For example, Title and Description displays the item’s title field, linked to the document or item, along with the description.
      These styles are XSL templates, not CSS styles. You can create your own XSL templates using SharePoint Designer 2010.
    • Fields to Display: Specify the fields that you want to map to the item style you select by typing them in the Fields to Display text boxes.
      In the case of most documents and articles, the Comments field is the default description field. For items, you have to decide which field you want to use. For example, the Tasks content type uses the Body field. Enter the field name Body in the Description field and the value of that field appears in the Web Part.
    • Feed: Indicate whether you want an RSS feed to be generated for the results of this query by selecting the Enable Feed for This Web Part check box.
  4. Click OK.
    Your query appears in the Web Part.
    image2.jpg

    Tuesday, 30 September 2014

    Difference between Data View Web Part(DVWP) and Content Query Web Part(CQWP)

    Data View Web Part
    1. Need SharePoint Designer to configure it
    2. Displays data/Items with in sub site
    3. Displays data ( items) from only one List/Library
    4. Binds to List/Library GUID
    5. XSLT Style Templates store on Web Part itself
    6. Available on all template
    Content Query Web Part
    1. Can be configurable from Browser
    2. Displays data/Items from Site Collection Level
    3. Displays data (items) based on Content Type
    4. Binds to Content Type
    5. XSLT Style templates stores on ItemsStyle.xsl
    6. Available on Publishing Portal template

    Features of DVWP

    • DVWP can fetch data from data sources other than lists like xml files.
    • DVWP can fetch data from other site collection.
    • DVWP can merge data from more than one list.

    Features of CQWP

    • CQWP can fetch data based on Content Type.
    • You can enable RSS feed in CQWP.
      • RSS feed in CQWP is XSLT based, which gives you option to customize the RSS feed. CQWP uses the /Style Library/Xsl Style Sheets/Rss.xsl file for rendering RSS feeds.
      • Edit the web part and add the “RSS Feed List” as a source.
      • In the Presentation Section under Feed enable feed for the web part. In the Fields to display map the Description list column with the Description slot.
    • You can map list columns with the Page properties.
    • CQWP generates Field to Display which you can map with your custom columns.
      • Slots are reusable templates in which you can map your Column Values without going into the code. CQWP parses the selected Item Style template and generates slots for it: every @Property becomes a slot.
      • We can map custom column values into these slots. E.g. If we a custom column ‘Category’ then we can map its value to ‘Title’ slot as below. Amazing thing is, we do not have to pull our hairs to get the internal name of the column. We just need to write the Display Name of the column to be mapped. So Title will take Category value now.
      • Moreover, you can map more than one column into the slot but only the first non-blank column value will be shown.

    Sunday, 21 September 2014

    Creating Fields or Columns in SharePoint List Programmatically using C# (Single Line Test, Multiline Text, Choice, Number, Currency, Date Time, Lookup, Person or Group)

    Today, in this article let's play around with one of the interesting and most useful concepts in SharePoint List

    Question:Creating Fields or Columns in SharePoint List Programmatically using C#(Single Line Test, Multiline Text, Choice, Number, Currency, Date Time, Lookup, Person or Group)

    It is very easy to add a column in a SharePoint List from website front-end, we just need to click "List Settings -> Create Column" and enter the title and type of the field, and click "OK" button. That's it, new field is created.

    In simple terms "When you create a custom list, a new empty list is created with just two columns - Title and Attachments. The list contains a single default view. Once you create the list, you can add more columns, views, and so on"

    We can use SharePoint API to create these fields and associate the corresponding attributes programmatically within an existing List. Provided below is a code snippet in C#.Net.

    using (SPWeb web = new SPSite("http://kapplesofts/").OpenWeb())
                {
                    web.AllowUnsafeUpdates = true;

                    SPList list = web.Lists["KapplesSofts List"];

                    //Creating List Fields or Columns

                    //single Line Text Field
                    string SLTInternalName = list.Fields.Add("Single Line Text", SPFieldType.Text, false);
                    //'false' means Required field not mandatory
                    //'true' means Required field mandatory 

                    //Multiline Text Field
                    string MLTInternalName = list.Fields.Add("Multiline Text", SPFieldType.Note, false);

                    //Choice Field
                    string fieldStatusName = list.Fields.Add("Status", SPFieldType.Choice, false);
                    SPFieldChoice fieldStatus = (SPFieldChoice)list.Fields.GetFieldByInternalName(fieldStatusName);
                    string[] activityTypes = { "Active", "Closed" };
                    fieldStatus.Choices.AddRange(activityTypes);
                    fieldStatus.DefaultValue = "Active";
                    fieldStatus.Update();

                    //or Choice Field Dropdown
                    SPField fieldCategory = new SPField(list.Fields, "Choice", "Category");
                    list.Fields.Add(fieldCategory);
                    list.Update();
                    SPFieldChoice CategoryField = (SPFieldChoice)list.Fields["Category"];
                    CategoryField.EditFormat = SPChoiceFormatType.Dropdown;
                    CategoryField.Choices.Add("Non Compliance");
                    CategoryField.Choices.Add("Observation");
                    CategoryField.Choices.Add("Suggestion");
                    CategoryField.Choices.Add("Improvement");
                    CategoryField.DefaultValue = "Observation";
                    CategoryField.Update();

                    //or Choice Field RadioButtons
                    SPField field = new SPField(list.Fields, "Choice", "Siverity");
                    list.Fields.Add(field);
                    list.Update();
                    SPFieldChoice rdField = (SPFieldChoice)list.Fields["Siverity"];
                    rdField.EditFormat = SPChoiceFormatType.RadioButtons;
                    rdField.Choices.Add("Major Finding");
                    rdField.Choices.Add("Minor Finding");
                    //DefaultValue empty
                    rdField.Update();

                    //Number Field
                    string NumberInternalName = list.Fields.Add("Number", SPFieldType.Number, false);
                    SPFieldNumber fieldTimeSpent = new SPFieldNumber(list.Fields, NumberInternalName);
                    fieldTimeSpent.DisplayFormat = SPNumberFormatTypes.NoDecimal;
                    fieldTimeSpent.Update();

                    // Currency field
                    string CurrencyInternalName = list.Fields.Add("Salary", SPFieldType.Currency, false);
                    SPFieldCurrency currencyTimeSpent = new SPFieldCurrency(list.Fields, CurrencyInternalName);
                    currencyTimeSpent.Currency = SPCurrencyFieldFormats.India;
                    currencyTimeSpent.DisplayFormat = SPNumberFormatTypes.TwoDecimals;
                    currencyTimeSpent.Update();
            

                    //Date Time Field
                    string fieldInternalName = list.Fields.Add("DOB", SPFieldType.DateTime, false);
                    SPFieldDateTime fieldDateTime = new SPFieldDateTime(list.Fields, fieldInternalName);
                    fieldDateTime.DisplayFormat = SPDateTimeFieldFormatType.DateOnly;
                    fieldDateTime.DefaultValue = "[today]";
                    fieldDateTime.Update();

                    //Lookup Field
                    SPField titleField = list.Fields.GetField("Title");
                    titleField.Title = "Employee Name";
                    titleField.Update();                              
                    SPList lookupList = web.Lists["Sample List"];
                    list.Fields.AddLookup("Employee FirstName", lookupList.ID, false);
                    SPFieldLookup lkp = (SPFieldLookup)list.Fields["Employee FirstName"];
                    lkp.LookupField = list.Fields["Employee Name"].InternalName;
                    lkp.Update();

                    //Boolean Field
                    string BooleanInternalName = list.Fields.Add("Boolean", SPFieldType.Boolean, false);

                    //Person or Group Field
                    string fieldUserName = list.Fields.Add("Employee Name", SPFieldType.User, false);
                    SPFieldUser userField = new SPFieldUser(list.Fields, fieldUserName);
                    userField.AllowMultipleValues = false;
                    userField.Required = false;
                    userField.SelectionMode = SPFieldUserSelectionMode.PeopleOnly;
                    userField.LookupField = "Title";
                    userField.Update();

                    list.Update();

                    web.AllowUnsafeUpdates = false;
                }


    Out Put list new form:

    List setting:

    Getting Started with Development on SharePoint 2010 Hands-on Labs in C# and Visual Basic

    Microsoft released the hands-on lab manuals for SharePoint 2010 to get started learning SharePoint 2010 development. they provided 10 hands on lab manuals, each one is available in C# and VB.NET

    Hope it helps you to learn about SharePoint 2010.


    Click here to Download 10 Lab Manuals

    Wednesday, 10 September 2014

    SharePoint site offline for Maintenance,Update Solution or Site - Quick way to Implement


    Here is the quick way to implement Maintenance page in SharePoint, during upgrade/service pack patching: Create a app_offline.htm file in IIS Root folder of your SharePoint site. Place some descriptive text/images to the file, Make sure the file size is at least 512 bytes (otherwise, you will get 404 page not found error!). That's all!

    File Location: C:\Inetpub\wwwroot\wss\VirtualDirectories\80


    When you have a file called app_offline.htm in your website, ASP.Net will show the content of this file instead of processing all the regular stuff that should happen.
    What does that mean for SharePoint?
    Sometimes you have to run an update, and you wish that no user accesses the site you are updating.

    App_Offline.htm and working around the “IE Friendly Errors” feature

    I've placed the maintenance page content like this:

     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >

    <head>
    <title>Application offline</title>
    </head>

    <body>
    <h1>This application is offline for maintenance</h1>
    <p>
    We are running updates in this system. The application will be available as soon as possible. We are sorry to cause inconvenience.
    </p>
    <!--
        Add some more stuff, so the file size will reach 512 bytes minimum:

        12345678901234567890123456789012345678901234567890
        12345678901234567890123456789012345678901234567890
        12345678901234567890123456789012345678901234567890
        12345678901234567890123456789012345678901234567890
        12345678901234567890123456789012345678901234567890
        12345678901234567890123456789012345678901234567890
        12345678901234567890123456789012345678901234567890
        12345678901234567890123456789012345678901234567890
        12345678901234567890123456789012345678901234567890
        12345678901234567890123456789012345678901234567890
    -->
    </body>

    </html>

    It’s important to place this file into the inetpub-directory. You cannot use this functionality, when you place this file into the root of a SharePoint-site using SharePoint Designer.When ASP.Net finds this file in the directory of the site, its content is sent back to the requesting client.



    Now, we can run our update procedure. But remember, you cannot access the SharePoint site using a browser. You have to use STSADM-commands, PowerShell-cmdlets or your own commandline tools.