Monday, 14 January 2019

Blocking Anonymous Users from Sharepoint List Pages

All public facing Sharepoint sites and Sharepoint intranet in some instance are configured to allow anonymous access. If anonymous users have read/write access to lists they will be able to see the Sharepoint list pages such as AllItems.aspx, Dispform.aspx, Editform.aspx, and Newform.aspx by using a URL.

Since this is not a desirable situation, anonymous users should be blocked from seeing the list pages. This can be achieved by changing the ASP.Net configuration settings for the Sharepoint site.  Following lines have to be added to the web.config file of the Sharepoint site.

<location path="lists">
   <system.web>
     <authorization>
       <deny users="?" />
     </authorization>
   </system.web>
 </location>

This will prevent the anonymous users from accessing any pages under Lists. If they try to navigate to a list page such as http://server/lists/listname/allitems.aspx they will be prompted for username and password.

Monday, 17 December 2018

[Fixed] Restore-SPSite : the extension microsoft.office.project.server.database.extension.projectdatabaseextension is of version xx.xx.xx.xx, and the backup was on version xx.xx.xx.xx. these versions are incompatible.

Sometimes we have to restore the site backup to another SharePoint server, but this is possible that source site backup has an older version than the target version.
Still, if we perform Restore-SPSite command for restoration than it gives below error due to these versions are incompatible.

Restore-SPSite : the extension microsoft.office.project.server.database.extension.projectdatabaseextension is of version xx.xx.xx.xx, and the backup was on version xx.xx.xx.xx. these versions are incompatible.



To fix this error ideally you should same Major and Minor server version of the source and the target server, but this is very rarely seen that both have the same minor versions. to fix this I am mentioning one trick that will fix this issue, BUT this is not a proper way to restore or There is no guarantee that it will work in your particular case.

  1. First, download the HxD hexeditor tool from here
  2. Open your .bak file using this tool
  3. Search for SharePoint version, in my case I looked for the minor version which is 16.1.273.0 and update it with the new version 16.1.307.0 so basically, I am restoring the lower SP version to higher SP version.
  4. Keep in mind you might get permission while writing/updating the .bak file using the tool, in that case, you have to give write permission to the system user to the backup folder.











Once you save the file after the change then you have to again run the Restore-SPSite command and this time it will successfully run and backup will restore to the new site collection.

Hope this trick will help someone. But remember that it is hack and use it carefully.  

Sunday, 16 December 2018

[Solved] Unable to decode images in internet explorer

ISSUE

You create a Multimedia Component in the Content Manager Explorer. For example, an image is uploaded to the component that is a PNG. You publish the item and it renders fine across all browser types.

You then rename this image file with a new name and extension type, for example, change it to be a JPG. Publish the Multimedia component and all browser types still render this image properly with the exception of Internet Explorer.

The browser will show an encoding error: "DOM7009: Unable to decode image at URL..."

CAUSE

This is a defect/limitation with decoding image MIME types in Internet Explorer.

Resolution

you can work around the issue with Internet Explorer rendering of modified images by first opening the image file in an application like MS Paint and then saving as a different image type (i.e. from PNG to JPG) OR select "Save As" option and save it on its current format. Then upload this image and check. I believe the issue will fix and the image starts to render on IE as well.

Migrating existing SharePoint server SQL to another SQL server

Recently I did the SQL server migration for my SharePoint 2010 machine.
My task is to migrate the existing SharePoint 2010 SQL which was pointing to SQL Server 2008 to SQL Server 2016.

For that I followed below steps:
  1. Took the SharePoint web applications database backup from SQL server 2008. (You can verify the attached DB from Central admin → Manage content database)
  2.  Attached those DB to the new SQL server 2016.
  3. Added the Admin User to the security group using SQL server 2016 management studio.
  4. Provided admin user following permission from Server roles section db_backupoperator db_owner 
  5. In my case I have to migrate the complete SharePoint to a new SQL server, for that, I have to create Central Admin as well, but you cannot migrate CA DB, you have to re-configure it using SharePoint product configuration wizard on the source server.
  6. Before doing this I took the screenshot for AAM settings and extract all WSPs files from CA (source server) using PowerShell, also took managed metadata service applications backups, other services like search, User profile etc, I created using configuration wizard and manually configure them from CA.
  7. Now I configured the CA (in source server) by disconnecting it from existing SQL server and choose "create new server farm", then I provided target SQL 2016 server details like database name, admin credentials, phrase (kind of password), CA port etc. once all required information provided, wizard starts configuring CA on source machine. after that, I configured a few services.
  8. Once CA is ready, I started creating web applications and dismount/mount the DB backups to it using PowerShell, for that first I have to dismount is newly created DB using below cmd: Dismount-spcontentdatabase "newly_created_webapp_db_name"
  9. Then mounted the old db which I already attached to the new SQL 2016 server (step-2) using below cmd: stsadm -o addcontentdb -url "http://newly-created-webapp-url" -databasename WSS_Content_old_db -databaseserver SQL2016SERVERNAM
After all this I was able to see from CA → Manage content database section that this site is connected to new SQL server, now its time to browse it. and it seems working fine. UI is good except some functionality which is related to services and web parts WSPs.
So make them functional again, I have to configure the MMS service which is responsible for my top navigation and again deployed the WSPs, once I did all these deployments and changes, the website works like a charm.

Now final work that I did is to configure the AAM settings for SP site from CA so that it can be accessed thru outside.


Thursday, 13 December 2018

[FIXED] Network images disappeared after asp.net site deployed to IIS 7 (Windows 2008 R2)

ISSUE:

I have a web application which shows network images when I ran it thru localhost. But when I host the site on IIS on the same server, the network path is not working. IIS site is not giving any permission issue nither it is giving "x" sign (404-Not found) for images.

I also provided the full permission to the system user over IIS site. Still, images are not loading.

I tried with the virtual directory (mapped image folder) but no luck.

Screenshot for the reference:


FIX:


Finally, I got the answer to my question from Microsoft forum

I assume the IIS doesn't support this kind of path. For that, I need to create a virtual directory to map it to the image file. Then use a domain account which has enough permission to access the image file in IIS Manager->site level->virtual directory level->basic setting->connect as->specific user->domain user.

Then only need to modify the path.

I already tried the virtual path earlier but this time I have provided enough permission to access.



[FIXED] “Run as different user” Visual Studio, cannot clear cached TFS credentials

Issue

I log onto my server with one set of credentials and open Visual Studio 2012 using "Run as different user" (Shift + Right-click) as I need a second set of credentials to deploy to my dev. env. SharePoint site.
I have previously done above and then connected to TFS using the third set of credentials, as my user (second set credentials) didn't have access yet. Now my user has access and I wish to use these credentials instead.
TFS automatically logs me in with the third set credentials every time I open VS using "Run as different user" - However, if I open VS normally without using "Run as different user" I get prompted for a login to the TFS.
I have tried checking the Windows credentials and there is nothing there. And I can't log onto the server using the second set credentials as only the first set can access the server with Remote Desktop.
So how do I "clear" cached TFS credentials when using "Run as different user"?

Fix

Go to control panel > User Accounts > Manage Your Credentials > select your Team Foundation Server and choose remove/edit - viola! Next time you go into Team Explorer you will be prompted for a new set of credentials.

Google Drive vs OneDrive: Which One is Good for you?

Let's find out which is the winner on below attributes:  Reference

The Verdict

OneDrive took three out of five rounds, but for our money, this victory falls easily in Google Drive’s favor. Round one, cost of storage, was more of a toss-up than a clear-cut victory for OneDrive. Rounds two and three, covering file sharing and sync, were only slightly clearer victories.

Google Drive, meanwhile, has a vastly superior third-party app library to OneDrive and its Google Docs suite is just as good as Office Online, leaving around four firmly in its favor unless you’re truly hung up on Office 365.  

The real key to victory here is security, though, which is saying something given that Google Drive isn’t exactly a bastion for user privacy. But if a zero-knowledge service like Sync.com is too light on productivity features for you, at least go with service that doesn’t leave your files in plain text.

Final Winner: Google Drive

OneDrive Vs OneDrive for Business - Which is good for you?

One Drive

OneDrive (previously known as SkyDrive) is a free storage space provided by Microsoft. You just have to type onedrive.com in your browser to find it.

To access it, you need a Windows Live ID which can be your Xbox Live account, your Outlook.com email account (previously Hotmail.com), your Skype account (the former MSN Messenger ID), or the account you used to sync your old Zune device. This Microsoft account is basically an email address and a password. That’s all.

With OneDrive, you get 5GB of free storage (15GB if you signed up before February 2016) that you can use to store any kind of file, including photos, video, and documents. OneDrive organizes your files by type for you, so it’s easy to find what you need. You can access your files from a PC or MAC or your mobile devices (Android, iOS, Windows Phone and even BlackBerry 10).

OneDrive is perfect to store your personal files. You can also share them with friends, family or even colleagues.

This version may be free, but you still get.
  • Unexpected options are available through the web browser. You can browse any connected PC you’ve set your OneDrive account on, so you can even access files stored on the PC that are not saved to OneDrive.
  • Windows 8.1 and later versions plus all Office applications will allow you to save files directly to OneDrive as a built-in feature; the same thing Outlook.com does for attachments.
  • File versioning will help you retrieve previous versions of your documents.
  • You can set OneDrive to automatically back up your camera files (photos and videos).
  • You can download the mobile and desktop apps as an alternative to using a web browser. The integration with Xbox will help you watch your personal images and videos saved on OneDrive directly on your TV.
You can also set two-factor authentication (2FA), which involves receiving a code on your mobile phone whenever you need to access it. Or, you can activate PIN or fingerprint identification for more security on the mobile app.



OneDrive can basically be compared to Dropbox, Box or Google Drive for your personal files.

OneDrive for Business

As its name indicates, OneDrive for Business is designed for organizations. It allows a company to provide cloud storage to its employees and manage its usage from a central location.

Talking about OneDrive for Business leads us to another Microsoft product: SharePoint. Why? Because when SharePoint 2013 was released, OneDrive for Business was part of a whole streamlined experience. Its role was to synchronize SharePoint document libraries across different user devices.

For those who don’t know, SharePoint is a collaboration platform for organizations. It provides a corporate website where teams and departments can create their own workspaces to store, co-author and share documents or any other professional files. Each user automatically gets a “My Site” library in SharePoint, which is like a home drive or an equivalent of the “My Documents” on their corporate PC. Depending on the server edition it runs on, SharePoint can allow the integration of different applications so it can be used as a unique platform for the company. SharePoint is either installed on-premises or hosted in the cloud. It’s not a free product, so companies have to buy licenses to run it. In other words, using OneDrive for Business involves some cost.

It offers advanced features compared with those available with the free version of OneDrive. The storage quota limit depends on the SharePoint platform your company uses. There is a limit in the number of files you can sync with OneDrive for Business: 5,000 for a regular document library and 20,000 for the “My Site” library. Of course, syncing files will help you use them offline on your devices. File versioning is enhanced for OneDrive for Business, as it involves the notion of minor and major versions. This is a very important feature in co-authoring.

Can OneDrive for Business be used without SharePoint? The answer is yes. Companies can choose to provide storage space for their employees for document backup or as a mobility feature. Microsoft offers that service as a paid cloud service that provides 50GB of space per user.

Wednesday, 12 December 2018

[Fixed] Sharepoint 2016 prerequisites fails - Download error

Users mostly facing issue while running Sharepoint 2016 prerequisites installer is - "Download error".

I also faced this issue while running the prerequisites setup, so that I manually download and install those components but this is not the solution. if you install prerequisites manually then there are 80% chances that your SharePoint is not configured properly using SharePoint product configuration wizard. I will point out those issues as well in my later post.

Let me come to the point, what error looks like:

now, HOW TO FIX THAT 

The problem is IE is set to not download files and also IE enhanced security is ON.

So before running the prerequisite installer, go into IE/Internet Options/Security/Custom Level and enable file downloads. However, this isn't enough.
Also, need to go into server manager and disable IE Enhanced security.
Set OFF in IE Enhanced Security Configuration option, in both places- Administrators as well as in Users, and click on OK.


















That's it, you are done!

Now try to run the prerequisites setup again, this time it will smoothly download the components without fail.

Monday, 7 March 2016

Branding SharePoint 2013 Tricks – 6 – Hiding Elements in Dialogs

SharePoint 2013 allows us to hide site elements in dialogs just as we could in SharePoint 2010. Just be aware that the class we add to such elements we wish to hide has changed.
Hide Element in Dialog - Error
The Problem:
In a custom branding project, you add a new container element, such as a new header, navigation block or footer to your System (default) Master Page. This element then appears in dialogs even though we do not want it to.
Solution:
In SharePoint 2010 we would add the following class to an HTML block we want hidden in dialogs.
1
s4-notdlg
such as
1
2
3
<div id="custom-header" class="s4-notdlg">
<!—the rest of the header-->
</div>
In SharePoint 2013 we use the same method, just a different class, ms-dialogHidden.
1
2
3
<div id="custom-header" class="ms-dialogHidden">
<!—the rest of the header-->
</div>
Hide Element in Dialog - SPD Code


















You can add the ms-dialogHidden class to any HTML element in your Master Pages, Page Layouts, or even content referenced by Master Pages in Webparts let’s say that you want to be hidden in a dialog.
Hide Element in Dialog - Good

Developer Dashboard in SharePoint 2013

How to enable it?

To enable the dashboard you need to create the Usage and Health Data Collection Service Application.

  Use the below power-shell command to create the service application.
New-SPUsageApplication -Name "Health and Usage Application" -DatabaseName "SP2013_Health_and_Logging_Database".
UsageApplication




Once you run the above command it will create the service application with the name Health and Usage Application and the respective database.
Once you have created the service application you have to enable the dashboard.
In the previous versions, we use to get three options ON/OFF/OnDemand settings for the dashboard.
Now in this version, you will get only two options ON/OFF.
To enable the dashboard, we will use ON setting and use the below PowerShell command.
$svc = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$dds = $svc.DeveloperDashboardSettings
$dds.DisplayLevel = "On"
$dds.Update()
After executing the above PowerShell command open your site on the top right-hand side of your site, you can see an icon to launch Developer Dashboard. Please see below Figure:1
You can enable the dashboard setting with object model as well.
Launch-developer-dashboard






Figure:1
Once you click on "Launch the developer dashboard" it will open the below Figure: 2
In that figure you can see what are requests, against each request you can observe server info, in server info  Aggregate status will give how many SQL queries have run, how many SharePoint requests and services has been called what is duration for each of them etc.
Developer-dashboard
Figure:2

SQL queries running against each request:
One of the most important criteria while designing the SharePoint solution is SQL. Because the performance of SharePoint depends on the SQL. We need for what type of queries runs in the background for each request so that it will be a great help for while troubleshooting the performance issues related to SharePoint.
Once you go to the SQL section of the dashboard you can see the queries name and execution plan details will get displayed once you click on those links.
Other than that there are few important parameters which will help us while troubleshooting the performance issue like what is the total duration to performance query, how many reads and write operations done by the query to the SQL server.
This makes easier for SQL DBA to troubleshoot the issues related to the performance of SharePoint.
Developer-dashboard-SQL Queries
Please see the below Figure where it displays the portion of a query execution plan.
Developer-dashboard-query-executionplan

ULS logs:

There are many cases where you want to check the error messages related to only that particular request.
In this dashboard, we have a separate section for the ULS logs to check against each and every request.




                                                                                                                                                                            One of the new features in SharePoint 2013 is a minimal download strategy. Earlier days whenever you access the page the complete page reloads again, it causes a decrease in performance. In SharePoint 2013 it's not the case, it will load the only portion of the page if there is any change so it drastically improves the performance of the application.
Developer-dashboard-MDS

Conclusion:

In this post we have seen how to enable developer dashboard in SharePoint 2013, what are the new features available in the dashboard and how this will help during troubleshooting issues related to SharePoint like most common performance issues.
Hope you have enjoyed this post.