Showing posts with label SharePoint. Show all posts
Showing posts with label SharePoint. Show all posts

Tuesday, September 22, 2015

App Launcher Visibility: SharePoint 2016 IT Preview


Microsoft has introduced App Launcher providing a new navigation experience in SharePoint 2016. It provides a quick access to the apps.
After executing the post-setup configuration wizard (psconfig.exe) of SharePoint 2016 IT Preview, the App Launcher was not visible on Central Administration site. I created a new web application with single site collection. When I accessed the new site collection, App Launcher was not visible.

At this moment, I have not created any service applications. Clearly I am not having all the functionality of SharePoint 2016 IT Preview in place to expect it to surface all UI components. I concluded that App Launcher might have some dependency on one (or more) service application(s).
I came across three scenarios which affected the visibility of App Launcher even after creation the service applications. This post provides more insight to each of the scenario.

Scenario #1: App Launcher not visible when no service application is created.
There are multiple service applications available in SharePoint. Which service application(s) the App Launcher has dependency on? Looking at the service applications list, I thought my farm should have App Management service application. I created App Management service application.
[Note: Before creating App Management service application, I created some of the basic service applications (i.e. State Service, Usage and Data Collection Service, Secure Store Service, Subscription Settings Service) along with Search service.]
Even after creation of App Management service application, the App Launcher was not visible.
Being curious, which service application make the App Launcher visible, I started looking into the SuiteNav feature and the related assemblies for the control rendering. The investigation led to below method in disassembled assembly.

 
The App Launcher will not be visible unless and until we have configured the My Site Host Url in User Profile Service Application. [Note: If you create User Profile Service Application in partition mode, you’ll not be able to configure the My Site Host Url.]
I created User Profile Service Application but still the App Launcher was not visible. I checked service connections group. The User Profile Service Application proxy was not selected for the default service connection group.
I added User Profile Service application to the service connection group

And…it’s there! It started showing the App Launcher in Central Administration.
Conclusion:
  1. App Launcher has dependency on User Profile Service Application.
  2. App Launcher requires User Profile Service Proxy in the web application’s service connection group.
  3. App Launcher will not show up if partition mode parameter is used to create User Profile Service Application [Not Tested. Reasoning: User Profile Service does not provide my site related configuration if the service created with partition mode.] It does not mean that App Launcher will not be available for multi-tenant farms. I will keep it open to explore more this topic.
Scenario #2: App Launcher is visible on Central Administration site but not on the other web applications.
The site collection, which I created initially, is not showing the App Launcher but the central administration site is showing it. Both web applications have the same default service connection group. I tried creating new web application and new site collection, it also had the same problem. I spent many hours after my work schedule on this.
With prior experience with old SharePoint versions, a thought came to my mind “Does it has anything to do with availability of root site collection?”. In both web applications, I have created the site collection on “/sites” managed path. There was no site collection on the root (“/”) of the web application.
Quickly I created the root site collection and … it’s there!
Conclusion:
  • App launcher will not be shown if there is no site collection created at the root of the web application.
Scenario #3: App launcher not visible on central administration site after IIS Web Site binding changes.
I have updated the IIS web site binding to “xyz.pqr.com”. I browsed the central administration site from Internet. I could access the site but the App launcher is missing from the site. But the site collections from other web applications were showing it when accessed from the Internet.
This one was very quick as I have intentionally avoided to specify the AAM configuration for the central administration web application. I added the AAM public URL and it started showing the App Launcher on the Central Administration site when accessed from the Internet.
Conclusion:
  • AAM configuration should be in place when we are accessing site from non-server machine and using fully qualified domain URL.

Sunday, May 26, 2013

Display Form returning 404 Not Found in a List created from Custom List Template

Recently one of the SharePoint site user complained that display form of a list is not working. We checked the list and everything was properly set (DefaultDisplayFormUrl ), but still it was not working. The list was created from a custom list template. The list template was based on an existing list (original list). The original list is working fine but the new created from the template was returning "404 Not Found" error.

I opened turned OFF the dialog and checked the URL it uses to launch display form. As the normal list behaves, it is first invoking the "listform.aspx" page with  query string. The "listform.aspx" page normally causes redirection to appropriate page type specified in the query string. Due to the 404, browser was not displaying the correct final URL. So I just launched the developer tools and checked the HTTP request/response cycle.

The "listform.aspx" is sending 302 for redirection but the location it was referring to the original list. As the original list does not have the new created display form of the new list. It was returning 404.

Then we removed content type ID from the query string and it was working fine. We further investigated and checked if it refers to wrong content type. It was referring to the content type available with the new list. So content type is not the issue.

Why "listform.aspx" referring to the original list?

I de-compiled the code of the "listform.aspx". The "listform.aspx" page invokes a method of ListFormWebPart. This method prepares the final display URL  based on the "DisplayFormUrl" property of content type.


The PowerShell script confirmed it that the problem is with the content type display form URL. The content type is right but it's property has wrong reference.

$web=Get-SPWeb http://
$list=$web.Lists[]
$ct=$list.ContentTypes[0];
$ct.DisplayFormUrl

We updated the DisplayFormUrl in script and it started working. Great job!!!

Monday, March 25, 2013

Lists.asmx: Method not Found


Recently we had an intermittent issues with lists.asmx. It was giving us SoapServerException as below:
Method not found: 'Microsoft.SharePoint.Utilities.SPChunkedStringBuffer Microsoft.SharePoint.SPListItemCollection.GetXmlInternal(Boolean, System.Collections.Hashtable, Boolean, Boolean)'.

The issue was occurring infrequently. We located the issue on two WFE machines.

The exception was saying "Method not found." This is little weird as how OOB dll file miss this method and what is the DLL it is referring to.

I opened the lists.asmx and found that it refers to STSSOAP.DLL.


I searched for the DLL file and we located at two different locations : 1. SharePointRootFolder\ISAPI 2. WebApplicationVirtualDirectory\_app_bin

While browsing through these directories I noted that the DLL files have different "Modified Date". We checked the other WFEs and this difference was not present there. The both files had different versions as "14.0.6024.1000" and "14.0.6122.5000". We recently had server patching and somehow this web application _app_bin folder had the old file and using it.

We replaced the DLL with latest version and the issue is resolved. :)


Wednesday, May 23, 2012

SPDocumentLibrary.CheckedOutFiles? A Common Misunderstanding

What is a checked out file?
Any file which locked for changes...so the changes are not visible to the other users. In SharePoint, we have a option to check out a file.
Go to the library, open a file's ECB (Edit Control Block) menu options and clik "Check Out" menu item.

So any file, which is checked out this way, is a checked out file. Isn't it? Yes, it is checked out file.

Now, try this.
Write a small console application, which will display count of SPDocumentLibrary.CheckedOutFiles. In case of SharePoint 2010, a small PowerShell script will do.

Execute the utility and note down the count of Checked Out files. Go to a document library and check out one file. Re-execute the utility and read the count...It does not change.Try again with two-three files. It does not change the count of SPDocuemntLibrary.CheckedOutFiles.

Why?
 MSDN describes "SPDocumentLibrary.CheckedOutFiles" as "the collection of files that are uploaded to the document library but are not checked in."

If the document library requires check out before editing any file and you upload a file to this library...the file will added in a checked out state. The file does not have a checked in version available. The file will not be visible to any one before check in.

SPDocumentLibrary.CheckedOutFiles represent the collection of files, which do not have a checked in version.

"Requires Check out" setting is available in "Version Settings" of library.

Can we override Check out of these files from Object Model?
SPDocumentLibrary.CheckedOutFiles is a collection of SPCheckedOutFile objects. SPCheckedOutFile does not derive from any class. SPCheckedOutFile does not have any member to check in the file.

SPCheckedOutFile has a property "ListItemId". If we exploit it to retrieve SPFile object, then we can check in the file. SPFile has a method "CheckIn". Code must be executed with the credentials of the user who has the ownership of these files. As the files are not visible to others, code with other user credentials fails to retrieve the SPFile object for these files.

SPCheckedOutFile type has a method "TakeOverCheckOut". If we use this method, you will have the file ownership and then we can retrieve the SPFile object for check in purpose.

Can we override check out of these files from UI?
These files are only visible to the user who has uploaded the files. Then how to override the check out for these files.
Go to the library settings, you will see a link "Manage Checked Out Files" in "Permissions and Management" category. MOSS 2007 and SharePoint 2010 has different versions of the link text as  follows.
MOSS 2007:
SPS 2010:
SharePoint 2010 corrected the confusing text.

So click on this link, and you can see the files which do not have checked in version. The UI provide the option to take the ownership of these files. Take the ownership of this files and from library view, you can check in/ delete the files. Taking ownership of these files, makes the files visible to you only and other users can not see the files.

Files checked out which have checked in version
Any file which is explictly checked out from the library...is visible to all with check out status. It can be retrieved as SPFile object. SPFile has properties to read the details of check out. These details are also presented in UI.

SPFile.CheckOutStatus property indicates whether the file is checked out or not. There are other members of SPFile which gives details about check out. e.g.CheckedOutBy, CheckedOutDate etc.

As the files are visible to all, we can easily override the check out of these files from UI or Object Model code.

To summarize
SPDocumentLibrary.CheckedOutFiles represents files which does not have checked version. This property does not count the files, which are explictly checked out. This property should not be used to report the number of checked out files.

Use loop in object model and count the files with CheckedOutStatus turned ON.  Then add the count of SPDocumentLibrary.CheckedOutFiles.

In UI, create a view of checked files, note the count of files. Visit "Manage Checked out files" link in library settings, count the files. Add the counts of these files.

Sunday, April 29, 2012

Missing "Manage Permissions" in Document Library

While working on a site, I encountered a document library where it was showing fewer menus in Edit Control Block (EBC) (also referred as List Item Menu). I noticed there is absence of "Manage Permissions" menu. It was a clear indication that document library has been broken. I tried to figure it out looking at the list schema, field schemas, views etc. but of no use.

"Manage Permissions" is the essential menu item to manage the item level permissions. Client was also interested in it.

The document library was the only one which was misbehaving in the site.

After looking at various options, I realized that we can provide "Manage Permissions" link using Custom Action.

SharePoint Designer 2010 has made it very easy to create Custom Action. Custom Actions can be created to display the new/edit or display form, to initiate a workflow or to navigate to a url. Custom Actions also support URL tokens such as {ListId}. I just observed the "Manage Permissions" link in other document libraries and analyzed the URL with query string parameters.

"Manage Permissions" navigate to : _layouts/user.aspx (application page)
Query string comprises of obj (it has list id/GUID, item id and entity category), and list (it has list GUID).

URL looks like as below:
http://server/<weburl>/_layouts/user.aspx?obj=<list Id>,<item id>, LISTITEM&List=<list id>

Custom Actions support various URL tokens. I referred the below URL tokens.
  1. {ListId} --List Guid
  2. {ItemId} -- Item Guid
My URL for custom action :

http://server/<weburl>/_layouts/user.aspx?obj={ListId},{ItemId},LISTITEM&List={ListId}

That's it! I named my custom action as "Manage Permissions". This is just a workaround. We will investiagate the reason behind misbehave and update the post.

Thursday, April 26, 2012

Filterable Multi-valued PeopelPicker Column using PowerShell

Recently I came across an error while filtering the multi-valued PeoplePicker column. The error reads "Cannot show the value of filter. The field may not be filterable, or the number of items returned exceeds the list view threshold enforced by the administrator." There are only four values in the column, surely it has no rleation to the list view threshold value.

Internally, SharePoint server uses "_layouts/filter.aspx" application page for filter values which are presented in an iFrame. I checked the ULS logs and copied the Request URL with filter.aspx. I pasted it in browser and hit "Enter". It returned no result.

What is multi-valued field?
The field which allows more than one values or which allows multiple selections. The multi-valued fileds are non-sortable, non-filterable. Multi-valued fields cannot be indexed.

Fix:
This behavior can be overridden. Every field has an associated schema. Multi-valued fields are marked as "Sortable =false" in the schema for performance reasons. Note: Apply the workaround wherever it is unavoidable.

If we mark the multi-valued PeoplePicker as "Sortable=true", the column turns filterable/ sortable. This can be achieved using SharePoint Server Object Model or using Windows PowerShell (I love it).

PowerShell Script to mark the column as Sortable:

$web=Get-SPWeb <weburl>
$list=$web.Lists[<list title>]
$field=$list.Fields[<field title>]
$strSchema=$field.SchemaXml
$str=Schema$strSchema.Replace("Sortable=`"FALSE`"","Sortable=`"true`"")
$field.SchemaXml = $strSchema
[Update: I noticed that multi-valued "person or group" coulmn in other web application was showing filter choices even though "Sortable=false". Googling did not help. I checked at various levels and found that "Online Presence" setting causes this error. If Online presence setting is turned OFF, SP 2010 starts showing this error for multi-valued columns when tried to filter. So turn it ON, and...no error, filter choices are shown back. The Online Presence setting is available in Web applications's General Settings.]

Tuesday, August 2, 2011

SharePoint: Site Columns and Content Types

There are various posts on the internet describing the site columns and content types. In this post I am co-relating these with concepts of objects and classes. This will help the developer visualize these concepts differently.

Content and Object

Object has data. Class provides the set of attributes to detail the object instances.

Content is data. Content has two categories: Structured and Unstructured.

Content comprises of documents and list items. Content does not include list or library itself. List or library helps user to organize the content.

Structured content is the one which separates its storage from its display. e.g. List Items can be sorted/filtered and viewed in List web part or data row in a SQL data table.

Unstructured content is the one which cannot be viewed separately the format in which they are stored. e.g. Word document cannot be viewed without the MS Office Word.

​

Content type provides the set of attributes to define the metadata about content. The attributes are provided in the form of columns/fields in the list or at the site level.

Site Column

When the column is defined at site level, it is a site column. The site column is reusable across all lists and libraries in the site.

This is very similar to have property declared in an interface and will be available across all objects implementing the interface.

Content Type

Content type is a set of site columns. The site column helps in describing the content. The content type can be used across the lists and libraries in the site.

This is just like a complex data type. The data types/ classes has properties to describe the object.