Quantcast
Channel: My SharePoint Notes
Viewing all 233 articles
Browse latest View live

Writing SharePoint PowerShell Modules or snap-ins

$
0
0
A module is a self-contained set of code that once loaded can be called/used.  I use modules to keep similar SharePoint functionality that I want to reuse.  There are 2 basic types of modules:
1.> Script modules, this is the easiest and most common type of module.  Take you .ps1 file and rename it .psm1
2.> Code/Binary modules are compiled dll's that can be loaded and used.  You can also create a snap-in with binary code.
3> Snap-ins, are compiled code dll's.  The snap-ins can be loaded and used within your PS console.


Snap-ins are not code modules.  I prefer to keep my files as ps1 files and load them in a controlling .ps1 files before using them or if I need to write code that uses the CSOM I would use C# and create a snap-in that I can port and consume.


More Info:
http://zimmergren.net/technical/sp-2010-how-to-create-a-powershell-snapin-part-1
http://www.wrox.com/WileyCDA/Section/Extending-Windows-Powershell-with-Snap-ins.id-320555.html




OWA intermittently not returning office documents in Office Web Apps 2013

$
0
0
Problem: Intermittent requests are not returning the pdf/word documents. Most requests are working and occasionally 1 request doesn't work. Every 4th request tries to get the pdf to display on Office Web Apps for a few minutes without any error message and then stops trying and displays the message"Sorry, Word Web App can't open this ... document because the service is busy."

I have 4 OWA/WCA servers on a stretched farm being used by SP2013 etc.

Initial Hypothesis: Originally I thought it was only happening to pdfs but it is happening to word and pdf documents (I don't have excel docs in my system). My monitoring software SolarWinds is badly configured on my OWA servers as the monitor is showing green, drilling down into the servers monitoring; the 2 application monitors are both failing. The server should go amber if either of the 2 applications monitoring fails and in turn red after 5 minutes. At this point I notice that I can't log onto my 4 OWA/WCA server. Web request are not being returned. I look at my KEMP load balancer and it says all 4 WCA servers are working, I notice the configuration is not on web requests but on ping (not right) and the NLB/KEMP is merely redirecting every 4th request to the broken server.

Resolution:
  1. Reboot the broken server, once it comes up I can make http requests directly to url http://wca.demo.dev/hosting/discovery on the rebooted server.
  2. SolarWinds monitoring is lousy - need to fixed the monitoring.
  3. Kemp hardware load balancing needs to be changed from checking the machine is "ON" to rather checking each machine using a web request.
SolarWinds Monitoring is not configured correctly

     

    SSRS 2012 with SP2013 component diagram

    $
    0
    0
    I like diagrams as they help me understand faster.  I wrote a post about 9 months ago about installing SSRS for SP2013, and recently a friend called me to moaned about the documentation available and I remember it being very poor.  My posts cover the topic be re-reading the posts and it could be clearer.  The key is to understand the pieces and where they sit.  He had seen my posts but some related to SP2010 and the 1 specific post relating to SP2013 using SSRS 2012 is not instantly understandable.  It has valuable info but where the parts/components reside is not perfectly clear so I put this diagram together.


    There are only 4 parts, the fewer servers to have the easier it is to do theses steps.  I.e. on 1 server farms like dev it's pretty easy as all the SQL components are installed hopefully during the initial SQL Server 2012 SP1 install.

    Part 1, you need a SP 2013 farm
    Part 2, you need to have a database with the SSRS components/functionality install.  Now if you are using the same database as your SP database ensure the SSRS components were installed at the initial build.  This diagram assumes you have a separate SQL instance which is pretty reasonable.
    Part 3, you need to run a core SQL install (only needs the SQL component relating to SSRS) on the SharePoint App/web server.  This 1 or more servers containing the SharePoint binaries.  This is the step that is new/different and most people don't do.
    Part 4, run some Powershell to create the SSRS SSA and hook up the relationship.  This is done on any of the SharePoint servers such as your main CA box.

    This post couple with the overview should help you understand the components needed for large or automated installs.
    http://blog.sharepointsite.co.uk/2013/08/installing-ssrs-2012-on-sp2013-within.html


    ====================


    Tip: If you need to move your Reporting Services database to another server, you need to manually add the RSexecRole to the new SQL Server.

    SharePoint 2013 Licencing

    $
    0
    0
    Overview:  I have looked at licencing in the past and SP2013 licencing seems

    • There is only 1 server licence (not longer, standard, enterprise or Internet as was the case in SP2010), pricing for the server licence has come down significantly.
    • Cals are still broken into Standard or Enterprise.  Pretty similar pricing but you can mix and atch cals depending on what your users use.
    • OWA is not paid for at the server level, no cals needed in read-only mode but if you are editing documents you need office cals licences.

    Disclaimer:  These are my note and I'm not an expert on licencing.  This is my rudimentary understanding.  If any one with good info pls comment or let me know so the post has real value.

    SP2010 licencing
    SP2010 licencing ore info on this site 

    Backup and Restore Site Collection in SP2013

    $
    0
    0
    Overview:  I have seen several customers us Backup and restore to help speed up the development process and have the ability to deploy between DTAP environments.  So the basic premise is create the site collection on dev/a and use backup and restore to promote the site collection including customisations and code in the next environment.

    SharePoint 2010:  In SP2010 this worked assuming the env you are going to has a higher patch level than the source environment.  So if you went from SP2010 + cu to SP2010 + SP1 in production backing up and restoring the site collection works.  The trick was to package all assets into the site collection and to ensure all environments were on the same edition/patch level (or at least the destination farm was patched to a higher level than the source farm).

    SP2013:  You can use PS backup and restore to move site collections but it is further restricted.  The source and destination environment need to be the same edition.  My issue is I can't move a troublesome production environment back to UAT as my UAT has been patched and is a later/newer version of SP2013 on prem.

    I learnt this when restoring the site collection from 15.0.4481.1005 (SP2013 + Mar CU) on the source and trying to go to 15.0.4569.1000 (SP203 + SP1) y destination farm.

    Restore-SPSite : 0x80070003
    At C:\Users\SP_install\AppData\Local\Temp\5ae5fd1c-86ac-4032-8975-c739f39b6f36.ps1:3 char:1
    + Restore-SPSite –Identity "http://uat.futurerailway.org"–path "C:\Software\Deplo ...
    + CategoryInfo : InvalidData: (Microsoft.Share...dletRestoreSite:SPCmdletRestoreSite) [Restore-SPSite], DirectoryNotFoundException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRestoreSite  

    Conclusion:  To move Site collection between farms or to different content databases, the SP farms need to be using the exact same version of SP.

    Anonymous REST JS call error using SP2013

    $
    0
    0
    Problem: I am making an anonymous JavaScript REST call to a image library.  I get the error "Request failed.  The method GetItems of the type List with id ... is blocked by the administrator on the server.nundefined".
     
    Resolution:  Change the ClientCallbackSettings on the web application as shown below.
     
     
    
    $wa = Get-SPWebApplication http://www.demo.dev
    $wa.ClientCallableSettings .AnonymousRestrictedTypes.Remove([microsoft.sharepoint.splist],"GetItems")
    $wa.Update()


    More Info:
    http://www.sharepoint-zone.com/search/label/ClientCallableSettings.AnonymousRestrictedTypes
     

    SharePoint 2013 publishing site blog won't allow anonymous access

    $
    0
    0
    Problem:  I have a public facing website that has a blog.  I have been hitting my head trying to make it anonymous when eureka Google saved me on a topic I had totally forgotten. 

    Initial Hypothesis: I have anonymous access enabled on the web application and on the site collection.  I started thinking it was the blog not inheriting permissions so I tried applying anonymous access at the site level followed by examining permissions on the posts list.  All erroneous so I reverted to full inherited permissions.  I Google-ed the symptoms and viola, it is the ViewFormPagesLockDown feature.

    Resolution: Turn off the ViewFormPagesLockDown feature for the site collection and anonymous access users will not get the credential prompt when accessing the post.
    PS> $lockdown = Get-SPFeature viewformpageslockdown
    PS> Disable-SPFeature $lockdown -url http://sitecollectionURL
    and confirm the change.

    More Info:
    http://blogs.msdn.com/b/varun_malhotra/archive/2012/01/13/can-t-access-a-list-on-an-anonymous-site-sharepoint-2010.aspx
    http://blog.mastykarz.nl/preventing-authenticated-visitors-browsing-system-pages/ (Important)

    SharePoint 2013 urls

    $
    0
    0
    I am often having to go to Google to find SP url formations, to work with the product as I don't memorise them.  Ahmed Farag has a good post on this:
    "Famous SharePoint URLs & Locations"

    My common ones are:
    Web Part Maintenance Page
    ?Contents=1
    Sign in as a different user
    /_layouts/closeConnection.aspx?loginasanotheruser=true
    Change Site Master Page
    /_layouts/ChangeSiteMasterPage.aspx
    Master Pages library
    /_catalogs/masterpage/Forms/AllItems.aspx
     
     
    This url is new to me:
    Get the version of the SharePoint server (Patch level)
     /_vti_pvt/Service.cnf

    CAML Designer for SharePoint 2013 is Brilliant

    Migration test of Sharegate to SP2013

    $
    0
    0
    Problem: I am looking at migrating some basic content into a SP2013 farm from SP2010.  I would normally opt for Metalogix or DocPoint if the client already has the licences but today I needed to use another tool namely Sharegate.  I used Sharegate.Migration.4.6.3

    Scenarios:
    SP2010 blog posts to an existing SP2013 blog.
    SP2010 lists into SP2013.

    Screenshot of the tool:


    Verdict:  A great tool, easy to use, mapped over data cleanly.  Absolute winner!

    SharePoint 2013 Zurb Foundation Publishing site tips

    $
    0
    0
    Advanced Banner


    Tabs



    Hover over image display
    <h4>Executive Directors</h4>
    <style>
    #tooltip1 { position: relative; }
    #tooltip1 a span { display: none; color: #FFFFFF; border-style: inset; border-color:#FFFFFF;  }
    #tooltip1 a:hover span { display: block; position: absolute; width: 150px; background: #aaa url(/PublishingImages/150x230/pbeck.jpg); height: 224px; left: 300px; top: -40px; color: #FFFFFF; padding: 0 0px; z-index:1; }
    #tooltip2 { position: relative; }
    #tooltip2 a span { display: none; color: #FFFFFF; border-style: inset; border-color:#FFFFFF; }
    #tooltip2 a:hover span { display: block; position: absolute; width: 150px; background: #aaa url(/PublishingImages/150x230/rlarkin.png); height: 224px; left: 330px; top: -40px; color: #FFFFFF; padding: 0 0px; z-index:1; }
    </style>
    <ul>
    <li id="tooltip1"><a href="#">Paul Beck, Chief Executive Officer<span> </span></a></li>
    <li id="tooltip2"><a href="#">Richard Larkin, Commercial and Strategy Director<span> </span></a></li>
    </ul>


     

    Content database Sizing & Cleanup

    $
    0
    0
    Problem:  At a customer site, a content database is massive.  Various Site collections are using the same content database. 

    Initial Hypothesis:  Smaller site collections can be moved to new separate content databases.  This reduces the size to some degree.  The SQL log (ldf) is in good shape.  The excessive size is due to 3 unavoidable issues, multiple versions of large blobs (we need the versioning so not an option).  The recycle bin is set to the default 50% and my dumping older content is brings down the size and lastly, delete content databases are still sored within SQL. 

    Resolution: Remove the previously deleted site collections fro the content database.   Using CA, I tried to run the "Gradual Site Delete timer job", it no difference, the delete site was still lingering about. 

    Used PowerShell to remove the deleted site collections as shown above.  E.g. PS> Remove-SPDeletedSite -Identity ""

    More Info:
    http://blogbaris.blogspot.co.uk/2013/01/delete-sharepoint-2010-site-collection.html
     

    SharePoint 2013 OOTB lookup list filtering

    $
    0
    0
    Problem
    I don't want to start customising my solution and I need a lookup column with restricted options.  I read this post from April Dunnam via Google and it's awesome and I wish I had thought of it first.

    I have 2 lists: Countries (Country, Continent) & Business (Name, LocationInAsia, LocationInEurope).  I want to be able to specify their head office in each continent.  I could do a lookup list to country and show all the countries or I can use Aprils approach and only show Countries for the specific region.  This is a contrived example but it's a simple way to explain it.

    Resolution:
    On the Countries list create a Calculated column/field, call it "AsianCountries". 
    The formula is =IF([Continent]="Asia",Country,"")
    On the Business list, create a lookup called "LocationInAsia" that points to the "AsianCountries" field in the Countries list.

    http://www.sharepointsiren.com/2013/05/sharepoint-2007-2010-2013-filtered.html

    Summary:
    This is pretty useful in that I don't need to write and custom code to have lookup lists that only show the appropriate content.  Sure I need to have extra calculate columns but a good no code way to restrict lists lookups.


     

    Office Web Apps 2013 for public facing websites

    $
    0
    0
    Overview:  A couple of weeks ago I told a customer that Microsoft offers a service to display Office documents thru Office Web Apps (WCA).  I thought I had read this or seen it on twitter but I was confident that viewing website office based documents was a free service offered by Microsoft.

    Initial Hypothesis:  I looked on the web and could not find anything and I had to hastily tell the customer I had made a mistake as I could not find anything about it on the web.  The customer decided to setup a public facing Office Web Apps Server to feed up office documents and pdfs for their websites.

    Fast forward a few weeks and the customer is installing a 1 server office web apps farm to display pdfs and word document from their public websites and I have been informed that there actually is a public service.  http://blogs.office.com/2013/04/10/office-web-viewer-view-office-documents-in-a-browser/

    "Do you have Office documents on your website or blog that you want your readers to view even if they don’t have Office installed?  Would you rather view a document before downloading it?  To give your audience a better experience, try the Office Web Viewer."

    To use the service there are a couple of considerations.  The service only supports office documents like word and excel, it doesn't support pdfs which is the clients preferred method of providing downloads.

    Resolution:  You do not need to perform WOPI binding to use the service. 
    The document is located at: http://calibre-ebook.com/downloads/demos/demo.docx

    All you need to do is prefix the url link as follows:
    http://view.officeapps.live.com/op/view.aspx?src=http://calibre-ebook.com/downloads/demos/demo.docx
     
    Summary: A nice service offered by Microsoft for viewing Office documents "on-the-line" O Wilson, V Vaughn 2013 (The Internship).  If won't work for pdfs and you will need to call the service in the html call.  Good to know it is available but it won't meet my clients needs.

    Tip: Ensure the link opens a new tab as the opened pdf will lose the clients context on yor site and force them to use the browsers back button.

    Note: To get WCA to open public documents on the web using the web viewer, you need to setup the SharePoint farm to use "external-https".  If you are using it both internally and externally, which I have not done, you need to use external-https and use Alternate Access Mapping (AAM).

    Example:
    Below is a single WCA server farm that I am using for both internal e.g. document libraries & external i.e. public SharePoint 2013 websites.  Note the Internal and External URL are the same, you could also use AAM as suggested earlier.

    FarmOU                            :
    InternalURL                       : https://wca.demo.co.uk/
    ExternalURL                       : https://wca.demo.co.uk/
    AllowHTTP                         : False
    SSLOffloaded                      : False
    CertificateName                   : wca.demo.co.uk
    EditingEnabled                    : False
    LogLocation                       : E:\OfficeWebApps\Logs\ULS\
    LogRetentionInDays                : 30
    LogVerbosity                      :
    Proxy                             :
    CacheLocation                     : E:\OfficeWebApps\Working\d\
    MaxMemoryCacheSizeInMB            : 5000
    DocumentInfoCacheSize             : 5000
    CacheSizeInGB                     : 40
    ClipartEnabled                    : False
    TranslationEnabled                : False
    MaxTranslationCharacterCount      : 125000
    TranslationServiceAppId           :
    TranslationServiceAddress         :
    RenderingLocalCacheLocation       : C:\ProgramData\Microsoft\OfficeWebApps\Working\waccache
    RecycleActiveProcessCount         : 5
    AllowCEIP                         : False
    ExcelRequestDurationMax           : 300
    ExcelSessionTimeout               : 450
    ExcelWorkbookSizeMax              : 10
    ExcelPrivateBytesMax              : -1
    ExcelConnectionLifetime           : 1800
    ExcelExternalDataCacheLifetime    : 300
    ExcelAllowExternalData            : True
    ExcelWarnOnDataRefresh            : True
    OpenFromUrlEnabled                : True
    OpenFromUncEnabled                : True
    OpenFromUrlThrottlingEnabled      : True
    PicturePasteDisabled              : True
    RemovePersonalInformationFromLogs : False
    AllowHttpSecureStoreConnections   : False
    Machines                          : {EXT-WEBDEMO1}

    I am using a SSL certificate installed on the WCA box as I don't have an SSL termination device (F5, Kemp).

    On the WCA VM I run the PS > Set-OfficeWebAppsFarm -OpenFromUrlEnabled:$True

    This gives me the generate.aspx page on the WCA farm to provide pdfs and office documents via the web viewer.  Mine is https://wca.demo.co.uk/op/generate.aspx

    ACS for SharePoint 2013 in a Picture


    SharePoint 2013 on-prem using Windows Live Id via Azure ACS

    $
    0
    0
    Overview:  I have a pretty simple requirement to allow users to register on my customers public SharePoint 2013 web sites.  I have setup custom providers and thought ACS was going to make me a hero at my client.  The whole experience is terrible and I can't see why anyone would use the default of LiveId via ACS due to the implementation.

    Opinion: I hate the way ACS works with Windows Live Id, it is so bad I can't see a scenario when a client would use it.

    Anyway, I have SP2013 SP1 on-prem and I want to hook at ACS allowing customer to register on the site and get elevate permissions on the site.  I'd like them to use multiple 3rd party authentication providers such as Facebook, Windows Live Id, LinkedIn and Google.  In my PoC I decide to simply use Live Id as it is the default on ACS and as both services are Microsoft owned it must be the easiest. 

    I worked thru Wictor Wilem's post series and as usual Wictor has provide a great resource.  I had to make minor adjustments to get it to work for me on SP2013 but overall, Wictors series of posts is a good place to start.

    The 1st issue I got was when logging in using Windows Live ID, I was continuously redirect back to the /_login/default.aspx page.

    After bashing my head trying to figure out what the issue was I realised in Wictor's common issues post in the series, he mentioned the claims mapping/rule needs to be adjusted for Live ID authentication. 

    I now was getting an access denied, which at least told me the claim was hooking up.

    The next issue was now I was getting the message you are not authorised "Sorry, this site hasn't been shared with you."

    Give all authenticated users access to the site as shown below.

    Once you login you will notice a horrible looking user that is logged in.   You can assign permissions using the "Friendly Username".


     

    SharePoint 2013 Search Series - Post 1 - Configure Custom Search

    $
    0
    0

    Overview: This series of posts examines SharePoint 2013 search.  It looks at configuration to get Search working for you.  There are other posts on this blog about configuring your Search architecture and farm.

    This post looks at 2 main points: 1.> crawling content and 2.>  Result Sources.

    Search Series:
    SharePoint 2013 Search Series - Post 1 - Configure Custom Search (This Post)
    SharePoint 2013 Search Series - Post 2 - Refiners

    1.> Crawling Content:  The UI in CA has changed but if you understood crawling in previous versions of SharePoint, it still works the same way.  You are looking to create indexes by crawling content.  The image below shows the Search Administration screen after choosing the "Content Sources" option.  This will allow you to create content sources and configure them so SharePoint can get data into the indexes and have permission awareness (ACL).

    After setting up your Content Sources run a full crawl to populate the indexes.

    The "Crawl Log" is extremely useful to see when crawls where run and what content has been included. 

    Once all the content is crawled you are ready to look at the Results Source formally referred to as Search Scopes.

    Tip: The crawler must run through all content to be searchable, I still see clients trying to restrict data by no crawling it.  Crawl everything and restrict on the query side what comes out. 
    Tip: Don't create to many Content Sources.  This can be a tough item to figure out, my advice is use as few Content Sources as possible and break them up by how often the content needs to be crawled.

    2.> Result Sources: You can create Result Sources at the SSA/farm level down to the web/SPSite level.  This example is looking to return data from a specific path for a particular content type, so I created the Result Source at the site level.

    Tip: The "Search Result Preview" is really useful for checking you are doing this correctly.

    Once I have a "Result Source" setup I go to my search page and add a "Search Results" web part to output the results to my user.  I  can edit the "Search criteria" on the web part to use my new "Result Source".  The picture below is annotated to explain setting up the Search Results Web Part.

     

    SharePoint 2013 Search Series - Post 2 - Refiners

    $
    0
    0
    Overview:  Refiners are a powerful way of drilling into your search result data.  This post aims to look at configuring the search refiner web part.  Any Managed Property can be marked as a refiner and then used on the Refinement Web Part.

    Steps to setup a refinement panel:
    1.> Add the "Refinement" search web part to your search page.
    2.> Edit the Web part and under the "Choose Refiners" button select the appropriate Refiners.

    3.> Add custom managed properties as shown below, mark the managed property as "refineable" and it will show up in the "available Refiners" screen.

    4.> Add your custom "Available Refiners"
    5.> Save and publish the web part and check the refiners are working.
     

    SharePoint 2013 SEO Note

    SharePoint 2013 Search Series - Post 3 - Search Box Web Part to only query Managed Properties

    $
    0
    0
    Search Series:SharePoint 2013 Search Series - Post 1 - Configure Custom Search
    SharePoint 2013 Search Series - Post 2 - Refiners
    SharePoint 2013 Search Series - Post 3 - Search Box Web Part query Managed Properties(This Post)

    Overview:  In this post we are looking at using a Display Template to change how the Search input box works.  Specifically the example will look at making the search box only search on the Title property of documents.  It will search for any part of the title.  If my word document is called "Std-634-HealthandSafety", using the search term "634" we get the document.

    Steps to Change the way the Search Box works:
    1.> Copy the Display Template "Control_Display Template", edit & rename the new template and upload to the Display Template gallery.
    2.> Change the Title element tag in the Display Template and amend the html as shown below to change the behaviour of the search box.
    3.> When the html display template is uploaded, you will notice the js file with the same name is updated.  Remember to Publish the html display template.
    4.> On the Search Page edit or add the Search Box Web Part.  Select the Display Template, in my case it is "Demo Title Search Box" and save.
    Search now only does a wild card search on the Title of the uploaded documents (assume the content has been crawled).
    Viewing all 233 articles
    Browse latest View live