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

Friday, November 6, 2015

Callout Extension for SharePoint 2013 Pages

In SharePoint 2013, Microsoft has Introduced a new Framework to Create CallOuts that is somewhat similar to the Dialog Framework Introduced in SharePoint 2010.

The SharePoint callout control provides a flexible way to engage user. When you do searches in a SharePoint 2013 site, you’ll see examples of the callout control in action, as it pops up whenever you hover over a search result.

Please find more details from MSDN

As you know Callouts are displayed OOB for following Lists & Libraries
  • Document Library
  • Assert Library
  • Images Library
  • Pages Library
  • Task Lists
So, I extended this to my custom page with a javascript.

Script:
<script type="text/javascript">
//This functions makes the request to the RESTful ListData service
function getListItems(sende,callback, OrderNumber, Element) {

    var Url = "http://servername/_vti_bin/ListData.svc/ElementsHelp()?$filter=OrderNumber eq "+OrderNumber+" and ElementValue eq '"+Element+"'";

    //Create a WebRequest object
    var request = new Sys.Net.WebRequest();

    //Specify the verb
    request.set_httpVerb("GET");

    //Use the URL we already formulated
    request.set_url(Url);

    //Set the Accept header to ensure we get a JSON response
    request.get_headers()["Accept"] = "application/json";

    //Add a callback function that will execute when the request is completed
    request.add_completed(callback);

    //Run the web requests
    request.invoke();
}

function onCompletedCallback(response, eventArgs) {
    //Parse the JSON reponse into a set of objects by using the JavaScript eval() function
    var shelptext = eval("(" + response.get_responseData() + ")");

    //Display some properties
    _elementhelpTitle = shelptext.d.results[0].Title;
    _elementhelpID = shelptext.d.results[0].OrderNumber;
    _elementhelpBody = shelptext.d.results[0].HelpText;

    var launchPoint = document.getElementById("Element"+_elementhelpID);
    var listCallout = CalloutManager.createNew({
        launchPoint: launchPoint,
        beakOrientation: "topBottom",
        contentWidth: 610,
        ID: _elementhelpID,
        title: _elementhelpTitle,
        content: "<div class=\"ms-soften\" style=\"margin-top:4px;\">
                        + "<hr/></div>" 
                        + "<div class=\"callout-section\" style=\"margin-top:10px;\">" + _elementhelpBody + "
",             }); 
 listCallout.open();
}

SP.SOD.executeFunc("callout.js", "Callout", function () {
});
</script>

Elements Help List:

Usage on page:

< a href="Javascript:getListItems(this, onCompletedCallback, '1', 'Element 1');" id="1">Systems are in place for reporting, investigating, analyzing, communicating and documenting all incidents (including significant near-misses). Analysis is conducted using statistically valid methods </a>

End Results:



Monday, December 22, 2014

Automate Deployments with PowerShell

I created and enhanced some PowerShell script code snippets for the purpose of fully automating any given SharePoint .WSP artifact deployment

Usual steps for a clean SharePoint deployment as follows:

DisableSPFeature(Disable-SPFeature cmdlet)

Disables a SharePoint Feature at the given scope. If the scope of the Feature is the farm, the URL is not needed. Otherwise, provide the URL at which this Feature is to be deactivated.

clip_image001

Usage: DisableSPFeature($CRMWebPartsFeatureId, $False)

UninstallSPFeature(Uninstall-SPFeature cmdlet)

Removes the specified feature definition from the collection of feature definitions in the farm.

clip_image002

Usage: UninstallSPFeature($CRMWebPartsFeatureId)

UninstallSPSolution($CRMWebPartsSolutionName, $False)

Retracts a deployed SharePoint solution.

clip_image003

Usage: UninstallSPSolution($CRMWebPartsSolutionName, $False)

RemoveSPSolution(Remove-SPSolution cmdlet)

Removes a SharePoint solution from a farm.

clip_image004

Usage: RemoveSPSolution($CRMWebPartsSolutionName)

AddSPSolution(Add-SPSolution cmdlet)

Adds a SharePoint solution package to the farm.

clip_image005

Usage: AddSPSolution($CRMWebPartsSolutionPath)

InstallSPSolution(Install-SPSolution cmdlet)

Deploys an installed SharePoint solution in the farm.

clip_image006

Usage: InstallSPSolution($CRMWebPartsSolutionName, $False)

EnableSPFeature(Enable-SPFeature cmdlet)

Enables an installed SharePoint Feature at the given scope.

clip_image007

Usage: EnableSPFeature($CRMWebPartsFeatureId, $False)

WaitForJobTimerToFinish (The Get-SPTimerJob & Start-Sleep cmdlet)

Reads a specified timer job, timer jobs of a specified type, or timer jobs defined for a specified scope. If no parameters are specified, this returns all timer job definitions for the farm. We will validate the state of the job in a while loop until null (finished) returned. Otherwise suspends the activity in a script or session for the specified period of time in our case 2 seconds.

clip_image008

Usage: WaitForJobToFinish

Please find the fully deployment script. Modify as need to fit your deployment.

Thursday, February 27, 2014

SharePoint 2013 One More Hidden Gem

If you are working with SharePoint 2013, you might always wonder how nice it would be if you could use

OOB "Get stared with your site" tiles for your web parts, application pages, apps, lists etc. if you are wondering how to do this, you are at right spot.

OOB Get Started With Your Site Tile:clip_image001

Let's get started then

  • Go to Settings >> Site Contents
  • Click on add an app, then search for "Promoted Links" app.
    • Once found click on it to add/create your own promoted links list.
    • Give it a name.
  • Navigate into the list by clicking it (obvious!)
    • You will see "The list is empty. Add tiles from the All Promoted Links view."
    • Click on "All Promoted Links" hyperlink.
    • Start adding your links here.
  • Here is a my sample link

clip_image002

  • Order: The tiles in the sequence you want them displayed.
  • All fields are self-explanatory.
  • Note: adding/editing the list items I found "All Promoted Links" view makes life easy.
  • Once you are done adding the links, go back to the page where you want to display them.
    • Click edit page
    • Navigate to Insert section
    • Click App part/webpart then select your list, save page and browse!

The Final Results:clip_image003

Thursday, March 7, 2013

Missing "Sign in as Different User" (SP2013)

As we all noticed a key feature(Sign in as Different User) was depreciated from SharePoint 2013.And I guess all the developer love to have this option back!.
And here is how you can get this option back.

Option 1: Update the webcome.ascx page from “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES” By adding below code in <CustomTemplate> section (watch out for Service Pack updates!, sometimes they over write your changes).
 
<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser" Text=" <%$Resources:wss,personalactions_loginasdifferentuser%>" Description=" <%$Resources:wss,personalactions_loginasdifferentuserdescription%>" MenuGroupId="100" Sequence="100" UseShortId="true" /%> 

ð Result

 


Option 2: Bring up login screen (Authentication). I guess, this is much safer option.
http://<Web>or<Site>/_layouts/closeConnection.aspx?loginasanotheruser=true

ð Result