Thursday, 8 January 2015

Add Presence to SharePoint Search Results

Hi all! It's been a long time since my last post here. Recently I have playing around with the user presence indicator in a custom display template results and it's amazing what you can do with the out-of-the-box functionality.

I based myself on this article:
http://www.ableblue.com/blog/archive/2013/06/05/add-presence-to-sharepoint-search-results/

The only thing the article was missing was how to get the id, wich you can do like this:
var id = ctx.ClientControl.get_nextUniqueId();

Have Fun!

Thursday, 20 November 2014

Getting the label value from a Taxonomy Field using CSOM



string labelValue = ((Dictionary<string, object>)item["FieldName"])["Label"].ToString();


Cheers,
HD

Tuesday, 11 November 2014

Disable Loopback Check using Powershell


Just run this command in PowerShell (check your privilegies).


New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -Value "1" -PropertyType dword


Cheers:
HD

Friday, 31 October 2014

Https Site Collection and High Trusted Apps


Having trouble with a https site collection and high trusted apps, specially with Callback validation?

Try this piece of code in your App:


public static void TrustAllCertificates(bool enable)
        {
            //Trust all certificates
         if(enable)
         {
            ServicePointManager.ServerCertificateValidationCallback =
                ((sender, certificate, chain, sslPolicyErrors) => enable);
         }
        }

It's not an elegant solution, but at the moment, it's the only one I know.


Good luck,
HD

Wednesday, 10 September 2014

How to Get Value from a Lookup Field using CSOM


Here is a good example:


var fieldToLook = oListItem["LookupSiteColumn"] as FieldLookupValue;

if (fieldToLook != null)
{
    var lookupValue = fieldToLook.LookupValue;
    var lookupID = fieldToLook.LookupId;
}


Cheers

Event Receiver Types ID


Here is the list of values of the SPEventReceiverType Enum: 


SPEventReceiverType.ItemAdding = 1
SPEventReceiverType.ItemUpdating = 2
SPEventReceiverType.ItemDeleting = 3
SPEventReceiverType.ItemCheckingIn = 4
SPEventReceiverType.ItemCheckingOut = 5
SPEventReceiverType.ItemUncheckingOut = 6
SPEventReceiverType.ItemAttachmentAdding = 7
SPEventReceiverType.ItemAttachmentDeleting = 8
SPEventReceiverType.ItemFileMoving = 9
SPEventReceiverType.FieldAdding = 101
SPEventReceiverType.FieldUpdating = 102
SPEventReceiverType.FieldDeleting = 103
SPEventReceiverType.SiteDeleting = 201
SPEventReceiverType.WebDeleting = 202
SPEventReceiverType.WebMoving = 203
SPEventReceiverType.ItemAdded = 10001
SPEventReceiverType.ItemUpdated = 10002
SPEventReceiverType.ItemDeleted = 10003
SPEventReceiverType.ItemCheckedIn = 10004
SPEventReceiverType.ItemCheckedOut = 10005
SPEventReceiverType.ItemUncheckedOut = 10006
SPEventReceiverType.ItemAttachmentAdded = 10007
SPEventReceiverType.ItemAttachmentDeleted = 10008
SPEventReceiverType.ItemFileMoved = 10009
SPEventReceiverType.ItemFileConverted = 10010
SPEventReceiverType.FieldAdded = 10101
SPEventReceiverType.FieldUpdated = 10102
SPEventReceiverType.FieldDeleted = 10103
SPEventReceiverType.SiteDeleted = 10201
SPEventReceiverType.WebDeleted = 10202
SPEventReceiverType.WebMoved = 10203
SPEventReceiverType.EmailReceived = 20000
SPEventReceiverType.ContextEvent = 32766
SPEventReceiverType.InvalidReceiver = -1


Cheers

Friday, 21 June 2013

Inject Controls on Visual Web Parts in SharePoint 2013

Memo to self:

"When injecting controls from code behind in a Visual Web Part in SharePoint 2013, use the Page Load event, not the CreateChildControls().

Example:

------------------------------------------------------------------------------------------------------------
  protected void Page_Load(object sender, EventArgs e)
        {
       
            this.EnsureChildControls();
            this.Controls.Add(new LiteralControl("<span></span>"));
        }

------------------------------------------------------------------------------------------------------------

Monday, 11 March 2013

Free eBook - 101 new features in SharePoint 2013


I strongly recommend a look at this free eBook:

101 new features in SharePoint 2013

Don't forget to thank the author, Isha Kapoor.

Wednesday, 12 December 2012

Two good tools to keep in your toolkit


Most of the time, I get to work in projects already in a Production environment.

Sometimes, the objective of the project is to resolve performance issues or migrated content / functionalities. 

Not often, but it happens, the source code and the SharePoint solutions are not available to you. 
In those hard times, i usually use this two tools:

SharePoint Farm Solution Extractor 
SharePoint Farm Solution Extractor is a great and simple tool that helps you extract the .wsp files in an SharePoint 2007 Farm.

ILSpy
A free alternative to the now paid .NET Reflector. It's a very nice .NET assembly browser and decompiler.

If you know any alternatives to this tools or have some tools you use, give me some feedback :)

Thursday, 23 February 2012

Custom Site Template in Variations


You have created a custom Site Template and you need to use it in your Variations?

Very simple.

Open your webtemp.xml file.
In the configuration node of your Template, you just need to add the following property:

FilterCategories="PublishingSiteTemplate"


Here's an example of my webtempMySiteTemplate.xml:

<?xml version="1.0" encoding="utf-8"?>
<Templates xmlns:ows="Microsoft SharePoint">
<Configuration ID="0"
Title="My Site Template"
Hidden="FALSE"
ImageUrl="/_layouts/images/CPVW.gif"
Description="My Custom Site Template Description"
DisplayCategory="MyCustomTemplates"
SubWebOnly="TRUE"
FilterCategories="PublishingSiteTemplate">
</Configuration>
</Template>
</Templates>

Now, after deploying your .wsp, check Variation Labels under Site Settings.
Your site template should now appear under the Publishing Site Template dropdown list:


(this print screen is in Portuguese :) )

Good luck ;)