Sladescross's Blog

Blogging about Sharepoint related stuff

Aspiring Architect: Deploying Custom Master Page Using a sharepoint Feature August 30, 2013

Filed under: Custom,Custom Master Page,Deploy,Feature,Master Page,Sharepoint Designer — sladescross @ 11:46 am

http://pratapreddypilaka.blogspot.co.uk/2013/03/deploying-custom-master-page-using.html?m=1

 

Azure Custom Virtual Machine January 8, 2013

Filed under: Azure,Certificate,Create,Custom,Image,Virtual Machine — sladescross @ 4:43 pm

http://www.windowsazure.com/en-us/manage/windows/how-to-guides/custom-create-a-vm/

You can create a custom virtual machine by providing advanced options, such as size, connected resources, DNS name, and network connection. You must use this option if you want to connect virtual machines or if you want to use a custom image to create the machine.

Before you create a virtual machine, you should decide how it will be used. If you have a need for only one virtual machine in your application, you choose to create a stand-alone virtual machine. If you need multiple virtual machines in the same cloud service that can communicate with each other and act as a load-balanced application, you choose to connect the new virtual machine to an existing virtual machine.

This is GUI based not PowerShell.

http://blogs.msdn.com/b/how24/archive/2012/11/06/windows-azure-iaas-upload-a-custom-build-vm-template.aspx

Windows Azure IaaS – Upload a custom built VM template.

The steps in summary are as follows:

1-      Create your VM using Windows 2008 Hyper-v Manager

2-      Prepare your VM to be used as a template (Generalize the VM aka sysprep)

3-      Create and register a management certificate to be used to connect remotely to your Azure subscription

4-      Connect and upload your VM to windows Azure

Third: Create and register a management certificate to be used to connect remotely to your Azure subscription

In order to be able to manage your Windows Azure subscription in general and more specifically any administration work that will require you to communicate with windows Azure remotely you will need to use a certificate installed on the machines you are using for the communication. That certificate should be added to your management certificate in your Windows Azure settings so it trusts the machines you will use to manage your account.

The management certificates enable client access to Windows Azure resources when using the Windows Azure SDK tools, the Windows Azure Tools for Microsoft Visual Studio, or the Windows Azure Service Management REST API. You can add as many as 25 management certificates to a subscription.

In our case (later in this article) you will see that we will use the Windows Azure ASK tools to upload the created VM Image.

Here are the steps to do that:

  1. Create a new certificate as follows:
  2. Open command prompt with elevated privileges
  3. Execute the following command:
  4. makecert -sky exchange -r -n “CN=<CertificateName>” -pe -a sha1 -len 2048 -ss My “<CertificateName>.cer”
 

Custom SharePoint Field June 5, 2012

Filed under: Custom,Custom SharePoint Field Type,Field Type — sladescross @ 1:49 pm

http://sharepointmagazine.net/uncategorized/developing-a-sharepoint-custom-field-type-for-displaying-crm-40-data

A custom field type consists of many different parts. The hub of the custom field is the field type class. If the custom field needs to store data in a more complex way than For example.e. a string or a number, this class will contain a reference to a field value class. If the custom field offers a custom presentation, then this class will also contain a reference to a field control class. In this field control class you can choose to dynamically build your controls in code or refer to a RenderTemplate defined in a user control.

When your custom field is all laid out it can be compiled into a dllan assembly. To inform SharePoint about the existence of your custom control and its structure you have to create a field definition file that needs to be deployed to the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML directory of SharePoint. This definition file contains CAML markup containing a reference to the assembly and the field type class.

 

 

Custom New Document Link May 30, 2012

Filed under: Custom,Link,New,New Document,Template — sladescross @ 11:33 am

http://www.novolocus.com/2009/03/04/add-a-create-new-document-link-to-a-page/

Where XXXX is the JavaScript I copied from the toolbar. So, my full HTML looked like:

 Create new Mod Prop

I save this, and set my content editor web part to have no chrome (no title or anything). Presto, done! I would point out that updating the template could mean updating the JavaScript in the content editor. Still, not a bad effort!

 

Document Set Custom Form May 28, 2012

Filed under: Custom,Document Sets — sladescross @ 2:57 pm

http://msdn.microsoft.com/en-us/library/ff512780.aspx

Add a document set custom (layout) form.

 

SharePoint Search Custom Controls May 14, 2012

Filed under: Custom,Search Custom Web Part — sladescross @ 2:03 pm

http://www.codeproject.com/Articles/18110/Search-User-Controls-for-Microsoft-Office-SharePoi

Although the out-of-the-box search Web parts provided by Microsoft Office SharePoint Server (MOSS) 2007 are very customizable, there are situations where you may want to develop your search interface to hook into MOSS. This download consists of a Search Box user control and a Search Results user control. The Search Results user control uses the new FullTextSqlQuery API to return the search results. As user controls (I might add a Web part version later), the look and feel are very easy to customize.

http://msdn.microsoft.com/en-us/library/ms493601.aspx

The following is the complete sample code for the Custom Keyword Search Web Part, described in Walkthrough: Creating a Basic Search Web Part Using the Query Object Model.

http://www.insidesharepoint.net/post/2011/02/16/Creating-a-sortable-CoreResultsWebPart-in-SharePoint-2010.aspx

To find out how to do this, I opened up trusty old .NET Reflector and tried to figure out how the sorting in the OOB CoreResultsWebPart works so I could override it to sort on some other column. I found that the CoreResultsWebPart uses a datasource. This datasource is of the type CoreResultsDatasource in the namespace Microsoft.Office.Server.Search.WebControls and it represents the data source control used to retrieve the search results for the Core Search Results Web Part (according to MSDN). This class contains all kinds of interesting properties, including the (largely undocumented) SortOrder property. The SortOrder property has the type Microsoft.Office.Server.Search.Query.SortCollection. I figured out that by adding my own managed properties to the collection the search results are ordered by that property.

Next I wanted to know where this datasource is configured in the reflectored code. It turns out that the CoreResultsWebPart has a ConfigureDataSourceProperties method in which the datasource is configured. So all I need to do is override that method and put my own code for sorting the datasource in there.

 

Custom Expiration Policy May 10, 2012

Filed under: Custom,Expiration Policy — sladescross @ 5:42 pm

http://code.msdn.microsoft.com/sharepoint/SharePoint-2010-Custom-debafcff

The purpose of the article is to demonstrate the use of a custom expiration policy associated to a SharePoint Content Type. The custom Expiration Policy can be used to invoke custom business logic at the time of expiration.

 

 

Custom Controls and Custom Application Pages July 26, 2011

http://blogs.technet.com/b/vedant/archive/2009/01/22/using-custom-asp-net-controls-in-sharepoint-2007.aspx

Custom controls for Sharepoint 2007.

To create a custom Control:

  • Create a Class Library project
  • Inherit from WebControl class in System.Web.UI.WebControls namespace or
    Control class in System.Web.UI namespace
  • Override the “Render” or “RenderContents” method

To use the custom Web Control:

  • Put the custom control assembly in Bin directory of Web application (GAC may
    also be used)
  • Mark it as a safe control in web.config
  • Open master page or a page layout file
  • Register the control using Register directive and assign a TagPrefix
  • Use the control using the TagPrefix and Class name

http://www.eggheadcafe.com/tutorials/aspnet/2145201e-00aa-4877-b5f7-cf150d7f0c5f/sharepoint-application-page-with-custom-controls.aspx

  • Add a folder under the LAYOUTS folder called “ASPX”.
  • Right click on the ASPX folder, Add new item, Select Text File.
  • Rename the TextFile1.txt to “CustomPage.aspx”

Step 3 – Create the code behind folder and
files

  1. Add a folder called “Assembly” under the project menu.
  2. Add a folder under the Assembly folder called “WebControls”.
  3. Right click on the WebControls folder, Add new item, Select Class.
  4. Rename Class1.cs to Control1.cs
  5. Right click on the WebControls folder, Add new item, Select Class.
  6. Rename Class1.cs to Control2.cs

Step 4: Add a Reference to
System.Web.dll

  1. On the Project menu, click Add Reference.
  2. On the .NET tab, click System.Web.
  • Associates aliases with namespaces and class names.
    <%@ Register TagPrefix=”CustomControls”
    Namespace=”Your Namespace Name” Assembly=”Your Assembly Name, Version=1.0.0.0,
    Culture=neutral, PublicKeyToken=You Public Key Token” %>
  • Add the Control Place Holder.
  • Add the Custom Controls to the Control Place Holder.
    <asp:Content ID=”Main” runat=”server”
    ContentPlaceHolderID=”PlaceHolderMain”>
    <table>
    <tr>
    <td>
    <CustomControls:Control1 ID=”control1″
    runat=”server”
    />
    </td>
    </tr>
    <tr>
    <td>
    <CustomControls:Control2 ID=”control2″
    runat=”server”
    />
    </td>
    </tr>
    </table>
    </asp:Content>

Step 6: Create The Image Control

  1. Open the Control1.cs file.
  2. Add the following using statements:
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
  • 3. Override the CreateChildControls method with this code:protected override void
    CreateChildControls()
    {
    base.CreateChildControls();
    Image imgButton =
    new
    Image();
    imgButton.ImageUrl = “/_layouts/images/eggheadcafe/eggheadcafe.jpg”;
    imgButton.ToolTip = “eggheadcafe”;
    imgButton.Attributes.Add(“OnClick”, “location.href(‘http://www.eggheadcafe.com&#8217;)”);
    imgButton.Attributes.Add(“style”, “cursor: hand;”);
    this.Controls.Add(imgButton);
    }

Label rss = new Label();
rss.Text = sb.ToString();
this.Controls.Add(rss);
}
http://blog.mastykarz.nl/extending-the-sharepointfieldvalue-webcontrol/

I would like to guide you through a process of creating a simple yet powerful custom WebControl. At the end of this post you should be able to use the example we will build here and extend it with new functionality to make it fit to your needs.

http://graegert.com/featured/using-spproperties-with-sharepoint-admin-pages

SPPropertyBag with custom administration page.

http://vintentou.wordpress.com/2011/04/06/set-page-title-dynamically-from-web-part/

Dynamically set page title.

ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder)Page.Master.FindControl(“PlaceHolderPageTitle”);
contentPlaceHolder.Controls.Clear();
LiteralControl control = new LiteralControl();
control.Text = “New title”;
contentPlaceHolder.Controls.Add(control);

 

MySite Customisation May 31, 2010

Filed under: Custom,Customisation,MySite — sladescross @ 8:54 am

http://blogs.msdn.com/b/sridhara/archive/2007/05/19/customizing-mysite-in-moss-2007.aspx

 

Sharepoint Custom Javascript April 26, 2010

Filed under: Custom,Javascript,Sharepoint — sladescross @ 8:49 pm

http://www.theartofsharepoint.com/2007/07/adding-external-javascript-files-into.html

SharePoint ScriptLink control (< SharePoint:Link />)

http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx

function getTagFromIdentifierAndTitle(tagName, identifier, title) {

  var len = identifier.length;

  var tags = document.getElementsByTagName(tagName);

  for (var i=0; i < tags.length; i++) {

    var tempString = tags[i].id;

    if (tags[i].title == title && (identifier == “” || tempString.indexOf(identifier) == tempString.length – len)) {

      return tags[i];

    }

  }

  return null;

}

_spBodyOnLoadFunctionNames.push(“fillDefaultValues”);

http://www.cleverworkarounds.com/2008/02/28/more-sharepoint-branding-customisation-using-javascript-part-2/

Use content editor web part.

http://www.cleverworkarounds.com/2008/02/28/more-sharepoint-branding-customisation-using-javascript-part-3/

Add web parts to content pages.

http://tidemo/tftp/Lists/IT%20Assets/DispForm.aspx?ID=2&Source=http%3a%2f%2ftidemo%2ftftp%2fLists%2fIT%2520Assets%2fAllItems.aspx&PageView=Shared&ToolPaneView=2

Append ?Contents=1 to the webpart page’s URL to display the Webpart Maintenance Page

 

 
Follow

Get every new post delivered to your Inbox.

Join 63 other followers