Tuesday, 28 June 2016

Delete Read only field from Sharepoint list/library

How to remove/delete a read only field programatically? 




SPSecurity.RunWithElevatedPrivileges(delegate
{
    using (SPSite spSite = new SPSite("siteurl"))
        using (SPWeb spWeb = spSite.OpenWeb())
        {
          SPList list = spWeb.Lists["ListName"];
                    SPField spField = list.Fields["ColumnName"];
                    spField.ReadOnlyField = false ;
                    spField.Update();
                    spField.Delete();
                    spField.ParentList.Update();
        }
});

                    

Sunday, 26 June 2016

Failed to start workflow Procedure or function CreateWorkflowInstance

Error:-

Failed to start workflow. Procedure or function 'CreateWorkflowInstance' expects parameter '@InstanceID', which was not supplied.


If  you get the above error in Nintex Workflow 
while starting a workflow


Cause:-You  have done something wrong in Nintex workflow Database while taking backup or  you have updated the newer version of database.

Solution:-

1. Open Central Admin - Nintex Workflow Management - Database setup - Edit
2. Set SQLserver, dbname (check connect to existing) and OK
3. It will take 15 minutes to reflect the changes wait 15 minutes or to see immediate changes .
4. do IISRESET.
5. Restart SharePoint Timer Job in "Services" now test your workflow again.






Wednesday, 22 June 2016

change the language of textbox dynamically usign google API

How to change the language dynamically in textbox using  Google API


To change the language use the "CTRL+G" Key inside textbox


Example:-







 <script src="https://www.google.com/jsapi" type="text/javascript">
</script>
<script type="text/javascript" language="javascript">
    google.load("elements", "1", {
        packages: "transliteration"
    });

    function onLoad() {
        var options = {
            destinationLanguage: [google.elements.transliteration.LanguageCode.ARABIC],
            sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
         
            shortcutKey: 'ctrl+g',
            transliterationEnabled: true
        };

        var control = new google.elements.transliteration.TransliterationControl(options);
        control.makeTransliteratable(['<%=txt1.ClientID%>']);
   
        //txt11 is the id of the control which you will use for the transliteration.
    }
    google.setOnLoadCallback(onLoad);
</script>


 

<div>
 <div class="Google-transliterate-Way2blogging">
     <%--      <input id="Text1" type="text" style="width:600px;height:200px" />--%>

 <asp:TextBox ID="txt1" runat="server" Width="400" TextMode="MultiLine"></asp:TextBox>


</div>
    </div>

Tuesday, 21 June 2016

highlight the selected row in gridview using Jquery

How to highlight the selected row in gridview using Jquery






    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
 <script type="text/javascript">
     $(document).ready(function () {
     //click on row
         $("#<%=gdv1.ClientID%> tr:has(td)").click(function () {
         //go through each row of the table
             $("#<%=gdv1.ClientID%> tr").each(function () {
             //set the all rows's default background          
                 $(this).parent().children().removeClass("selection");
             });    
             $(this).addClass("selection");
         }, function () {    
          //   $(this).parent().children().removeClass("selection");
             $(this).addClass("selection");
         });      
     });
    </script>
<style type="text/css">
    .selection
    {
        background-color:Gray;
        border :1px groove #888888;
        color:White;
    }
</style>
   <asp:GridView ID="gdv1" runat="server">
   </asp:GridView>


Saturday, 18 June 2016

may be due to a misconfiguration of the Microsoft SharePoint Server State Service

Error:- When you start a workflow and get the below error


 The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service. For more information, contact your server administrator


Cause:- Because State Service is not working or not configured 


Solution:- Create New State Service Application
If you have already created remove them and reconfigure the state service application it will not harm the existing workflow configuration or InfoPath configuration

Create State Machine Service Application


$stateName ="State Service"
$stateDBName = "SP2013_State_Service"
$stateDB = New-SPStateServiceDatabase -Name $stateDBName
$state = New-SPStateServiceApplication -Name $stateName -Database $stateDB
New-SPStateServiceApplicationProxy -Name "State Service Application Proxy" -ServiceApplication $state –DefaultProxyGroup


Saturday, 11 June 2016

Feature for list template 'xx' is not installed in this farm



when get the such type of error




{"Feature '2bae83fc-4c6e-4587-a896-bf03c3d700d1' for list template '171' is not installed in this farm. The operation could not be completed."}.


Cause :- You have a Custom feature (wsp) or OOB template that has been uninstall or has been retracted.


Solution :- Re-Deploy the custom solution ( wsp ) or Activate the regarding feature .

Could not load file or assembly

To make Visual Studio adding 3rd party assembly or even your own assembly from other project in solution to GAC please do next:

  1. Open Package.package from Package folder in SharePoint project visual studio.
  2. Click Advanced in bottom area.
  3. Click Add and chose which type of assembly you want to add.
  4. In dialog select dll file, chec GAC or BIN, add safe controls and class resources entries if required. Click Ok.
Your assembly will be packaged to WSP, defined in manifest and deployed everytime.