Give Permission to User to Execute

You created a new stored procedure and tried to execute it and ended up with following error;

This is due to permission on the stored procedure. Run the following SQL to assign permission to the user

Grant Execute on dbo.[usp_GetArchiveProjectWeekWise] to moereports

Advertisements

Applying Custom CSS To List Forms

You can use the following CSS in a SharePoint to modify default list forms (New, Edit and Display). Just copy paste the following code into a file, save it Style Library or wherever you like with .css extension. Edit SharePoint List page and add content editor web part and copy the link to our custom CSS.



#rejectiontable td {
    /*border: 1px solid grey!important;*/
}


#idAttachmentsTable td {
    border: 0px solid grey!important;
}


table
{

	border-collapse: collapse;

}

.ms-standardheader {
    font-size: 1em;
    margin: 10px !important;
    text-align: right !important;
    font-weight: normal;
}


td.ms-formlabel {
    border: 1px solid grey!important;
}
   
td.ms-formbody {
    border: 1px solid grey!important;
}
    
.ms-formbody {
    background: transparent;
    padding: 15px 10px !important;
    font-size: 16px;
}

.headerBody
{	
    color: #ffffff !important;
    background-color: #0097A7;
    font-size: large;
    text-align: center;
    padding:5px;    
    border: 1px solid grey!important;
}

h2, .ms-h2 {
    font-size: 1.46em;
    color: white;
}


.ms-metadata, .ms-descriptiontext {
    color: #777;
    font-size: 12px;
}




Compiling C# Code From Command Prompt

Quite often, I quickly need to test a small piece of code and if you’re doing some customization on SharePoint, I hate to open project, apply the code, publish, and deploy over the server (retract, remove and redeploy!). I post this, so I can copy and paste and run the code quickly.


using System;

class TestClass
{
    static void Main(string[] args)
    {
	Console.WriteLine("Hello World!");

       // Keep the console window open in debug mode.
        Console.WriteLine("Press any key to exit.");
        Console.ReadKey();
    }
}

Run command prompt as administrator and change the directory as follows

C:\Windows\system32>cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>csc   -out:"C:\EPM\Code\my code.exe" C:\epm\code\main.cs
Microsoft (R) Visual C# Compiler version 4.6.1586.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports 
language versions up to C# 5, which is no longer the latest version. For compilers that 
support newer versions of the C# programming language, 
see http://go.microsoft.com/fwlink/?LinkID=533240

Compile the code as given below. You will have your exe file in the defined path.
Double-click the file and there you go, you’ll get your code running in no time.

The certificate chain was issued by an authority that is not trusted

Problem:

Details:
I was having the issue connecting Power BI reports from systems outside server.

“Microsoft SQL: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 – The certificate chain was issued by an authority that is not trusted.)”

Solution:

If the port is not the default one, use database name with the port number like this

Applying CSS Styling to Read Only Project Custom Field

Had a requirement to apply CSS on a Project Custom Field, which is set to read-only through workflow stage. Challenge here was how to get div of that field where we only ‘guid’ attribute.

Following the HTML of a read-only custom field.

<div guid="cc056a66-c75c-e711-80cc-0050568d9644">

<p>​director comments</p>

</div>

After applying jquery, it picks the field as shown below and applies css.

<script src="/PWA/SiteAssets/jquery-1.10.2.min.js"><script>

$(document).ready(function(){

var myDiv = $('div[guid="cc056a66-c75c-e711-80cc-0050568d9644"]');
myDiv.attr("style", "border: 1px solid #ABABAB; padding-left:5px");

});

</script> 

After applying css, custom field HTML looks something like this;

<div style="border: 1px solid rgb(171, 171, 171); padding-left: 5px;" guid="cc056a66-c75c-e711-80cc-0050568d9644">

<p>​director comments</p>

</div>