Preventing User’s from Changing the Auto Generated ShortUrl Name when creating ShortUrl’s
Below describes how to enforce the automatically generated ShortUrl Name to be used by creators. Users cannot Change the ShortUrl unless they establish direct access to the ShortUrl List.
SharePoint 2007
1. Navigate to:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\ShortUrl
2. Before any changes are made make a Backup Copy of the Default.aspx file.
3. Open and edit Default.aspx;
Locate Existing:
<asp:TextBox ID=”txt_UserShorUrl” runat=”server” class=”ms-formdescription” ></asp:TextBox>
Add: readonly=”True”
Full Replaced Code for Existing:
<asp:TextBox ID=”txt_UserShorUrl” runat=”server” class=”ms-formdescription” readonly=”True” ></asp:TextBox>
Locate Existing:
<asp:Button ID=”Bnt_Delete” runat=”server” OnClientClick=”DeleteConfirm()” Text=”Delete” class=”ms-formdescription”/>
<asp:Button ID=”Bnt_Edit” runat=”server” Text=”Edit” class=”ms-formdescription” />
Add: OnClientClick=”this.disabled = true; this.value = ‘Not Allowed.’;”
Full Replaced Code for Existing:
<asp:Button ID=”Bnt_Delete” runat=”server” Text=”Delete” class=”ms-formdescription” OnClientClick=”this.disabled = true; this.value = ‘Not Allowed.’;” />
<asp:Button ID=”Bnt_Edit” runat=”server” Text=”Edit” class=”ms-formdescription” OnClientClick=”this.disabled = true; this.value = ‘Not Allowed.’;” />
4. Save Deafult.aspx
SharePoint 2010
1. Navigate to:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ShortUrl
2. Before any changes are made make a Backup Copy of the Default.aspx file.
3. Open to edit Default.aspx;
Locate Existing:
<asp:TextBox ID=”txt_UserShorUrl” runat=”server” class=”ms-formdescription” ></asp:TextBox>
Add: readonly=”True”
Full Replaced Code for Existing:
<asp:TextBox ID=”txt_UserShorUrl” runat=”server” class=”ms-formdescription” readonly=”True” ></asp:TextBox>
Locate Existing:
<asp:Button ID=”Bnt_Delete” runat=”server” Text=”Delete” class=”ms-formdescription”/>
<asp:Button ID=”Bnt_Edit” runat=”server” Text=”Edit” class=”ms-formdescription”/>
Add: OnClientClick=”this.disabled = true; this.value = ‘Not Allowed.’;”
Full Replaced Code for Existing:
<asp:Button ID=”Bnt_Delete” runat=”server” Text=”Delete” class=”ms-formdescription” OnClientClick=”this.disabled = true; this.value = ‘Not Allowed.’;” />
<asp:Button ID=”Bnt_Edit” runat=”server” Text=”Edit” class=”ms-formdescription” OnClientClick=”this.disabled = true; this.value = ‘Not Allowed.’;” />
4. Save Default.aspx
After this modification when creating a ShortUrl, the ShortUrl Name is now Read only. Existing ShortUrl’s will not be able to be edited or deleted unless accessed directly to the ShortUrl List in the Root Web Application Site Collection.