Friday, 28 June 2013

Cannot perform this operation. The file is no longer checked out or has been deleted - SharePoint Designer 2013

While working in SharePoint Designer 2013, sometime it demanded to check out files that are not checked in, refused to check in other files. And it shows below error message:

Cannot perform this operation. The file is no longer checked out or has been deleted

After some search on google, I found this post, which helped a lot.

We need to clear the cache of sharepoint designer. The cache is composed of these 2 folders:
  • %APPDATA%\Microsoft\Web Server Extensions\Cache
  • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
Just delete their contents and you are done.


Thursday, 18 April 2013

External Content Type to read data from SQL Server using SQL Authentication

How to add external css in visual webpart in SharePoint 2010

If you want to add external css on visual webpart,
  1. First go to layouts folder in 14 hive, path is C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS
  2. Create a new folder in it and give a proper name to that folder.
  3. Add your css files in that newly created folder.
  4. Now to call the css file from your webpart code, add below tag in your ascx file <SharePoint:CssRegistration ID="cssReg" runat="server" Name="/_layouts/ForCss/style.css"></SharePoint:CssRegistration>
Done. Hope this helps.

Saturday, 22 September 2012

SharePoint Custom List form with horizontal RadioButtons

In sharepoint list form we don't get options to show radiobuttons horizontally and they take to much space of form if there are too many of them.

We can make those radio buttons vertically using some javascript. I searched on google and I found below post.
http://www.mickyjay.co.uk/blog/?p=668

We need to open the form in designer and add below javascript in it.

<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("reconfigRadios");
function reconfigRadios()
{
var inputs = document.getElementsByTagName("INPUT");
var radios = new Array();
for (var i=0; i < inputs.length; i++)
{
    if (inputs[i].type == "radio")
    radios.push(inputs[i]);
}var html = new String();
var openTable = "<TABLE cellSpacing='0' cellPadding='0'
width='100%' border='0'><TR>";
var closeTable = "</TR></TABLE>";for (var i=0; i < radios.length-1; i++)
{if (i == 0)
html = openTable;
var obj = radios[i];
while (true)
{
    if (obj.tagName == "TD")
    break;
    else
    obj = obj.parentElement;
}
html = html + "<TD>" + obj.innerHTML + "</TD>";
if (radios[i].name != radios[i+1].name)
{
   html = html + closeTable;
   var obj2 = obj;
   while (true)
   {
      if (obj2.tagName == "SPAN")
      break;
      else
      obj2 = obj2.parentElement;
   }
   obj2.innerHTML = html;
   html = openTable;
}
if (i == radios.length-2)
{
   obj = radios[i+1];
   while (true)
   {
      if (obj.tagName == "TD")
      break;
      else
      obj = obj.parentElement;
   }
   html = html + "<TD>" + obj.innerHTML + "</TD>";
   html = html + closeTable;
   var obj2 = obj;
   while (true)
   {
      if (obj2.tagName == "SPAN")
      break;
      else
      obj2 = obj2.parentElement;
   }
   obj2.innerHTML = html;
}}}</script>




Friday, 1 June 2012

Programmatically sending mail in SharePoint using SPUtility class

To send mails using SharePoint API, we can use SPUtility class sendMail method. For reference http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.sendemail.aspx
To use this method we will require:

using Microsoft.SharePoint.Utilities;
using System.Collections.Specialized;

You can assign to, cc, bcc, from, subject by creating stringdictionary, like
StringDictionary headers = new StringDictionary();
headers.add("to",strTo);
headers.add("cc",strCC);
headers.add("bcc",strbcc);
headers.add("from",strFrom);
headers.add("subject",strSubject);
headers.add("content-type","text/html");


string emailBody = “Hi<br><br>Sending mails using SPUtility.”;

SPUtility.SendEmail(web, headers, emailBody);

Where web is SPWeb object that represents site from which you want to send mail.

Friday, 10 February 2012

Input mask on textbox in SharePoint list form

Yesterday on LinkedIn I saw one discussion where one of group member asked a query about how to create Input mask on text box in SharePoint List form.

While searching on internet I found this post. In this post Author opened the new form in SharePoint designer, added custom new form and then added jQuery code on page.

But what if I do not have SharePoint designer.

So instead opening page in SharePoint designer, I added CEWP on NewForm.aspx

And then I did some changes in original code, Instead of custom style I used Title of the field. And I inserted below code in Source editor of the CEWP.

<script language="javascript" src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript" ></script>
<script language="javascript" src="http://jquery-joshbush.googlecode.com/files/jquery.maskedinput-1.2.2.min.js" type="text/javascript" ></script>
<script language="javascript" type="text/javascript">

jQuery(function($){
   $("input[title='Phone']").mask("(999) 999-9999? Ext.99999");
});

</script>

And it worked for me. Have a look at below screenshot.








Reference:
http://www.a2zdotnet.com/View.aspx?Id=194 (Original post)
http://digitalbush.com/projects/masked-input-plugin/





Related Posts Plugin for WordPress, Blogger...