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

Monday, November 23, 2015

Deploying a WSP to SharePoint 2013



How to deploy a WSP to SharePoint Farm Solution library

This need to be done on the Server which host the SharePoint Central Administration.
  1. Add the WSP to the SharePoint Server
    1. The first thing you need to do is copy over the wsp deployment file. The best things to do is to create a deployment folder, where all the deployed files are kept.
    2. Copy over the deployment files to: c:\Deploy\WSP
  2. Add the WSP to the SharePoint Farm Solution library
    1. Open "SharePoint 2013 Management Shell " as administrator
      a. Open the Search on Server 2012
      b. Search for "SharePoint 2013 Management Shell"
      c. Right click "SharePoint 2013 Management Shell"
      d. Select "Run as Administrator"
    2. Run this script: 

      Add-SPSolution "c:\Deploy\WSP\{file name}.wsp"  
  3. Deploy the WSP to the SharePoint Farm Solution library

    1. Open Central Administration
    2. Click "System Settings"
    3. Click "Manage farm solutions", under "Farm Management"
    4. Click on the {file name}.wsp package
    5. Click "Deploy Solution"
    6. Deployment settings
      Deploy When: Now
      Deploy to: All content Web application
    7. Click "OK"

How to activate the WSP Feature on the Site Collection

  1. Activate the WSP Feature on the Site Collection
    1. Open the Root Site (the Site Collection)
    2. Click the cog, in the top right corner (Site Actions)
    3. Select "Site Settings"
    4. Click "Site collection features", under "Site Collection Administrator"
    5. Go to {file name}
    6. Click "Activate", to the right

Wednesday, October 7, 2015

Query times out (very slow) when executed from web, but super-fast when executed from SQL Server Management Studio (SSMS)


Some cache corrupt on your SQL server, Run 2 commands to clean:

DBCC DROPCLEANBUFFERS 
DBCC FREEPROCCACHE

DBCC DROPCLEANBUFFERS removes any non dirty (iow, clean) pages:
Use DBCC DROPCLEANBUFFERS to test queries with a cold buffer cache without shutting down and restarting the server. To drop clean buffers from the buffer pool, first use CHECKPOINT to produce a cold buffer cache. This forces all dirty pages for the current database to be written to disk and cleans the buffers. After you do this, you can issue DBCC DROPCLEANBUFFERS command to remove all buffers from the buffer pool.

DBCC FREEPROCCACHE does is empty the procedure cache.
Removes all elements from the plan cache, removes a specific plan from the plan cache by specifying a plan handle or SQL handle, or removes all cache entries associated with a specified resource pool. Use DBCC FREEPROCCACHE to clear the plan cache carefully. Freeing the plan cache causes, for example, a stored procedure to be recompiled instead of reused from the cache. This can cause a sudden, temporary decrease in query performance

Extra Note:

The ARITHABORT setting is one of the things the optimizer looks at when it is determining how to execute your query (more specifically, for plan matching). It is possible that the plan in cache has the same setting as SSMS, so it uses the cached plan, but with the opposite setting your C# code is forcing a recompile (or perhaps you are hitting a really BAD plan in the cache), which can certainly hurt performance in a lot of cases.

 SET ARITHABORT ON; SELECT ...

Reference: http://www.sommarskog.se/query-plan-mysteries.html

Clearing the cache DBCC DROPCLEANBUFFERS and DBCC FREEPROCCACHE did the trick! The execution plan was somehow corrupt or not updated.

Reference: http://stackoverflow.com/questions/6585417/stored-procedure-slow-when-called-from-web-fast-from-management-studio

Wednesday, May 20, 2015

The list of workflow actions on the server references an assembly that does not exist. Some actions will not be available

When I tried to create SharePoint 2010 workflows in SharePoint Designer 2013, I got the following error message shown below:


This error may occur if the system does not have enough memory, I was running a VM at 4GB; when I scale up to 6GB, it’s working fine. in some cases, This error comes up if you don’t have local privileges, therefore, you need to check you local admin privileges. 

If you already checked the previous reasons and the problem not solved! so you need to clear the cache of the following Folders (If didn’t work delete them):
  • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
  • %USERPROFILE%\AppData\Roaming\Microsoft\SharePoint Designer\ProxyAssemblyCache
  • %USERPROFILE%\AppData\Roaming\Microsoft\Web Server Extensions\Cache
If the problem still exists that mean someone has extended the Workflow actions available in SPD with a custom action developed in Visual Studio.These custom actions are loaded when your workstation reads the WSS.ACTIONS file on the server.

The file is located in the 14 hive under Template\1033\workflow.Your WSS.Actions file contains a reference to a custom action .dll. Delete WSS.Actions file and your designer should start working again.

Make sure you take a backup of the file first.


Reference: https://mohamedelkassas.wordpress.com/2014/12/26/the-list-of-workflow-actions-on-the-server-references-an-assembly-that-does-not-exist-some-actions-will-not-be-available/

Thursday, April 9, 2015

How to Sign in as a Different User in SharePoint 2013

SharePoint used to have a menu option called “Sign in as Different User” in the top-right corner of every page. It was a handy tool for developers and IT professionals in SharePoint 2007 and 2010, which allowed them to login with another account to test their solutions or customizations. Microsoft removed the option in SharePoint 2013, but you can still do it with workarounds or a one-click bookmarklet.

Navigate to the Close Connection Page

http://<site URL>/_layouts/closeConnection.aspx?loginasanotheruser=true

Reference: http://blog.credera.com/technology-insights/microsoft-solutions/how-to-sign-in-as-a-different-user-in-sharepoint-2013/

Sunday, March 29, 2015

SharePoint 2013: How to hide All Day Event, Recurrence and Category fields from Calendar New Item form

Using Content Editor Web part and JQuery, you can easily hide the unwanted fields like All Day Event, Recurrence, Category fields from SharePoint Calendar new item form.
  • Navigate to the SharePoint Calendar in SharePoint site where you need to remove the fields.
  • From ribbon, Click on Calendar tab
  • In Customize list section of Calendar ribbon, click on arrow besides Form Web Part. You will see three forms named Default New form, Default Display form and Default Edit form. Click on Default New form.
  • In Default New form edit page, click on Add a Web Part and select the Content Editor Web part.
  • From Content Editor Web part, Click on Click here to add new Content
  • Now select Edit Source from ribbon and add java script to HTML Source editor to hide the fields from calendar form and click OK. To hide exact field, you can start count of TR from Title field as 0 and update the number in java script.
you can also use following scripts to hide fields:

 <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
 <script type="text/javascript">
 $(document).ready(function()
 {
 $('nobr:contains("All Day Event")').closest('tr').hide();
 $('nobr:contains("Recurrence")').closest('tr').hide();
 });
 </script>

Reference: https://hpatel.wordpress.com/2014/06/05/sharepoint-2013-how-to-hide-all-day-event-recurrence-and-category-fields-from-calendar-new-item-form/

Change the default tile size/tumbnails view in image library in Sharepoint 2013


Using a CSS only approach, add the following CSS inside the content editor webpart or add it to your custom css.

<style type="text/css">
            div.ms-promlink-body {
                height: 130px;
            }
            div.ms-tileview-tile-root {
                height: 150px !important;
                width: 150px !important;
            }
            div.ms-tileview-tile-content, div.ms-tileview-tile-detailsBox,  div.ms-tileview-tile-content > a > div > span {
                height: 140px !important;
                width: 140px !important;
            }
            div.ms-tileview-tile-content > a > div > img {
                max-width: 100%;
                width: 100% !important;
            }

            ul.ms-tileview-tile-detailsListMedium {
                height: 100px;
                padding: 0;
            }
            li.ms-tileview-tile-descriptionMedium {
                font-size: 11px;
                line-height: 16px;
            }
            div.ms-tileview-tile-titleTextMediumExpanded, div.ms-tileview-tile-titleTextLargeCollapsed, div.ms-tileview-tile-titleTextLargeExpanded {
                padding: 3px;
            }
             div.ms-tileview-tile-titleTextMediumCollapsed {
                font-size: 12px; !important;
                padding-left: 6px; !important;
            }
             li.ms-tileview-tile-descriptionMedium {
                font-size: 11px;
                line-height: 14px;
                padding: 3px;
            }
           
</style>

Tuesday, January 6, 2015

Combining 2 SQL queries and getting result set in one

You can aliasing both query and Selecting them in the select query

SELECT x.a, y.b FROM (SELECT * from a) as x, (SELECT * FROM b) as y

Sunday, December 14, 2014

SharePoint 2013 - Change URL of document library

When you create a document library, it ask you the name for the DL. Once you give it, it will create library with same name and URL. You can change the name of the library any time but cannot change the url. Here are the things i followed to create url accroding to my needs:
  1. Just go to a library trough 'Site Content'
  2. When inside the library choose on the ribbon 'Library' tab.
  3. Then select 'Open with Explorer'.That will open your SharePoint's library in Windows Explorer window.
  4. Navigate one folder up and you will see list of your libraries as folders.
  5. Rename required library's folder name as you want the URL to look like.
  6. Close the windows and refresh the browser or go back to home page and browse the library again.
Reference:
http://sharepoint.stackexchange.com/questions/111524/sharepoint-2013-change-url-of-document-library
http://stackoverflow.com/questions/12904944/change-sharepoint-library-url

Wednesday, November 12, 2014

SharePoint 2013 - Check Correlation ID using Management Shell

<GUID> = Correlation ID = 0e90cb9c-1855-80fc-177a-ebaed1a55500

Code:
get-splogevent | ?{$_.Correlation -eq "<GUID>"} | select Area, Category, Level, EventID, Message | Format-List
Example:
get-splogevent | ?{$_.Correlation -eq "0e90cb9c-1855-80fc-177a-ebaed1a55500"} | select Area, Category, Level, EventID, Message | Format-List

Tuesday, November 11, 2014

Minimal Download Strategy in SharePoint 2013 ( _layouts/15/start.aspx issue)

_layouts/15/start.aspx is part of the Minimal Download Strategy in SharePoint 2013 which helps in improving the performance of page rendering. If you are having issues with it you can deactivate this feature at the site level using the below step.

Site Settings >>  Site Actions >>   Manage Site Features >>  Deactivate Minimal Download Strategy Feature.

Wednesday, October 29, 2014

How to Enable or Disable Document Property Promotion (ParserEnabled) in SharePoint 2013

This is the way to solve issues on uploading document into SharePoint 2013 Document Library. After upload the document into SharePoint library, the document had the metadata (document properties) of the original document. Metadata that is changed on the document will revert to the original values that were given to the document; this occurs both from SharePoint and from MS Word.
 
Solution 1 – Remove Document Properties & personal Information using Inspect
1.      Open file using Microsoft office
2.      Click file and the inspect document (check for issues)
3.      Tick only on document properties & personal information
4.      Inspect & then remove
5.      Then Save
6.      Upload document into SharePoint.
 
Solution 2 – Disable Document Property Promotion using PowerShell
The SPWeb object has a ParserEnabled property, which enables or disables this functionality.  Using the PowerShell script, we can turn off this functionality at the web level. Sample script to disable the document parser feature in SharePoint:
1.      Open the SharePoint 2013 Management Shell as Administrator.
2.      Run the following script to disable document property promotion.
 
C:\> $web
        Url
        ---
        http://spfe01/sites/SITENAME/SUBSITENAME
C:\> $web.parserenabled
        True
C:\> $web.parserenabled  = $false
C:\> $web.Update()
C:\> $web.parserenabled
        false
 
 
3.      Document Property Promotion is disabled successfully and when you try to upload a document you will find that all the fields are empty
 

Wednesday, October 8, 2014

Clear SharePoint Designer 2013 Cache

When using SharePoint Designer, especially in a development environment where content and assemblies can frequently change, SPD can start to behave erratically, sometimes loading content that has been removed from the web site, or using an older version of an assembly. This is due to how SPD caches content, which thankfully, is easy enough to clear.


Step 1: First, close SPD and then remove all files from the following folder:
%APPDATA%\Microsoft\Web Server Extensions\Cache

This contains things like page caches.

Step 2: Then, do the same for this folder:
%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache

This contains cached items such as assemblies used and lots of other xml configuration files.

Step 3: Restart SPD and all should be good in the world

Reference: http://www.stuartroberts.net/index.php/2012/07/18/quick-tip-9/

Sunday, December 9, 2012

SharePoint 2013/2010 - Add PDF icon to the images library

Step 1: Open Image Folder at the SharePoint Server

c:\Program Files\Common Files\Microsoft Shared\web server extensions\<port>\TEMPLATE\IMAGES
<port>: e.g. 12

Step 2: Copy the following image to the folder:

(.gif for SharePoint 2010) (.png for SharePoint 2013)


Step 3: After you copy the picture file you need navigate to
“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML”

Step 4: And edit the DocIcon.xml with notepad and add the line
<Mapping Key=”pdf” Value=”icpdf.gif”/>

Once this is edited and saved (I would also recommend doing a backup of the file before you save it) you will need to do an IISreset before the icon will display.