About Me

My photo
a Dynamic and Energetic guy.....

Wednesday, December 16, 2015

Content Editor WebPart With CSOM

Im writing simple code to save data to LIST using CSOM, include in CEWP.
The Code of full file that can be bounded to CEWP.

=======================================================================

<div onkeydown='javascript:if (event.keyCode == 13) postSurvey()'>
    <p>1. How is the weather?<br />
         <input name='q1' id='q1Bad' type='radio' value='Bad'/><label for='q1Bad'> Bad</label><br />
         <input name='q1' id='q1Good' type='radio' value='Good'/><label for='q1Good'> Good</label><br />
         <input name='q1' id='q1Great' type='radio' value='Great'/><label for='q1Great'> Great</label>
    </p>
    <p>2. How are you doing?<br />
         <input name='q2' id='q2Fine' type='radio' value='Fine'/> <label for='q2Fine'>Fine</label><br />
         <input name='q2' id='q2Good' type='radio' value='Good' /><label for='q2Good'> Good</label><br />
         <input name='q2' id='q2Great' type='radio' value='Great' /><label for='q2Great'> Great</label>
    </p>
    <input type='button' value='Submit' onclick='javascript:postSurvey();' />

</div>

/*
These 2 files are really important, The Order is also important
*/

<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js" ></script>

<script language='javascript' type='text/javascript'>
        function getCheckedValue(buttonGroup) {
            if (!buttonGroup)
                return '';
            var objLength = buttonGroup.length;
            if (objLength == undefined) {
                if (buttonGroup.checked)
                    return buttonGroup.value;
                else
                     return '';
            }
            for (var i = 0; i < objLength; i++) {
                if (buttonGroup[i].checked)
                    return buttonGroup[i].value;
            }
            return '';
        }
     
        function postSurvey() {
       
            // Retrieve the radio button values

            var question1 = getCheckedValue(document.getElementsByName('q1'));
            var question2 = getCheckedValue(document.getElementsByName('q2'));

            /* Validate the response.
               Do nothing more until all questions are answered.
            */
            if (question1 == '' || question2 == '') {
                alert('Please answer all questions.')
                return;
            }

// Get the current context
           var context = new SP.ClientContext.get_current();

           // Get the current site (SPWeb)
           var web = context.get_web();

           // Get the survey list
           var list = web.get_lists().getByTitle('SampleSurvey');

           // Create a new list item
           var itemCreateInfo = new SP.ListItemCreationInformation();
           var listItem = list.addItem(itemCreateInfo);

           /* Set fields in the item.
              In managed code, this would be listItem[fieldname] = value.
              In Javascript, call listItem.set_item(fieldName,value).
           */
           listItem.set_item('How_x0020_is_x0020_the_x0020_wea', question1);
           listItem.set_item('How_x0020_are_x0020_you_x0020_do', question2);
           listItem.update();

           // Create callback handlers
           var success = Function.createDelegate(this, this.onSuccess);
           var failure = Function.createDelegate(this, this.onFailure);

           // Execute an async query
           context.executeQueryAsync(success,failure);

        }

// Async query succeeded.
function onSuccess(sender, args) {

    alert('Thank you for responding to our survey!');
     
    // Refresh the page.
    SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
}

// Async query failed.
function onFailure(sender, args) {
    alert(args.get_message());
}
    </script>

Sunday, November 22, 2015

Set Priority for a SQL Instance in a Failover Cluster Manager

After we set up a SQL Cluster with all the NODES and INSTANCES(Roles), In a Fail-over scenario the Instance will be move to "Best Possible NODE". In an environment that we have 3++ NODES, can we set the ORDER to fail-over for an INSTANCE?

When we select the relevant INSTANCE, we can see the "Preferred Owners = Any Node" in the panel. That means in a fail-over it will be moved to best possible node (after considering available resources). If we want to change it, CLICK "Any Node" link button.
We will get a pop-up and there we can see all the available NODEs. They are in the default Order (ie:- Node1, Node2, Node3)
First we have to change the ORDER using UP button, until we are getting most necessary NODE to the TOP. 

After we set the ORDER we have TICK the necessary NODES to make them available for Fail-over. If not these changes wont be get effected. We have set the HIGHEST PRIORITY for NODE-3. 

*** Since all other INSTANCES also running in NODE-3, if we select 'Best Possible Node', by default the INSTANCE-1 Should move to NODE-1.(Because Node-1 is not having any running Instance)

But after we set the Priority, the "Best Possible Node" will be the highest priority node.
That means though Node-1 is idle, the INSTANCE-1 has moved to NODE-3 from NODE-2. Also we can see the "Preferred Owners=User Settings" in bottom of the panel.
This is a  cool feature that comes with Fail-Over Cluster Manager.



Add and Remove Nodes from a SQL Cluster and Move Instances

After we set up the Windows cluster we need to add / remove nodes with different requirements. First we have to open "Windows Cluster Manager"
We can see all 3 Nodes in the Panel. If we want to remove NODE3 from the server, we need to run a small power-shell script.

We have to specify, "remove-clusternode [servernodename]"
After  the execution we can see the 3rd Node is not available in the Cluster Manager.
When we want to add a NODE, it is also simple. After we open the "Windows Cluster Manager", we can see "Add Node" option in right panel.
There we have specify the Server - Node name and ADD option. After the execution we can see new NODE has been added to Cluster Manager.
If we want to Move an Instance (Role) , we can choose either "Best Possible Node" or "Select Node" option. For that we have to RIGHT Click on the necessary ROLE. In the pop-up we can see available running possible NODES.

We can select necessary Node to swift the INSTANCE.
If we disable (make offline) any NODE using cluster Manager,
When we try to Move a NODE, we will wont get that option in the POP-UP window.

Like wise we can Move Roles (Instances) between NODEs.









Friday, November 20, 2015

SQL Server Management Studio is Missing (SSMS.exe) in Clustered SQL Farm

After we install SQL Server 2012 including Management Studio Tools, and trying to connect to a SQL server we are getting a surprising ERROR. Here SSMS.EXE means SQL Server Management Studio.

"The application has failed to start because of side-by-side configuration is incorrect".
As expected the executable  of Management Studio is missing. So we have to go to physical folder where we install SQL Server.
As Expected we can see a few DLLs files resides in ManagementStudio folder. There should be a mismatch in DLLs to get this error. Because of that. If we install Management Studio EXE only, it wont work. So we have Open SQL Installer.
Then We have to Select REPAIR Option Under MAINTENANCE.
The other important thing is, we have Select "REPAIR SHARED FEATURES ONLY" if you have Clustered SQL Environment.
After the Installation is completed, we can see Management Studio is repaired. We can see few more DLLs in the ManagementStudio folder.
Now We can open "SQL Server Management Studio" properly.








Monday, September 21, 2015

How to track User Profile Sync Issues in SharePoint 2013

User Profile Synchronization is a default feature that we gets with SharePoint 2013. When we need to migrate User accounts, properties to SharePoint we are using User Profile Synchronization. But due to various reasons we are failing to do so. 
To Track those issues we are getting a cool utility with SharePoint 2013.
It is miisclient located in /15/Synchronization Service/UIShell


After Open this utility we can see all synchronization attempts and the results.
It is called "Synchronization Service Manager on SERVERNAME".

There we can identify all attempts, time, status and Errors.


Here it says, "Replication Access was Denied" when trying to sync.




Monday, June 15, 2015

Hide DELVE / VIDEO icons in Office 365 SharePoint portal

There are a lot of icons in the RIBBON in SharePoint portals.
If we do not want to use those, we can disable using Settings.
We have to Go to 
Admin Center --> SharePoint Section

After we get SharePoint manage page,
Then we have to go to SETTINGS section.

To hide DELVE we have to DISABLE "Office Graph" option.
To Hide VIDEO we have to DISABLE "Streaming Video Service" option.

After SAVE and refresh the page. We wont be able to see DELVE icon and VIDEO icon.



Thursday, May 21, 2015

Can't Edit Office 365 SharePoint Site Using SharePoint Designer

When we want to EDIT Office 365 SharePoint Site Using SharePoint Designer, we are getting unexpected error.
When we click OK it will "The Server couldn't complete the request". 


This error happens when we OPEN root site, we can OPEN sub sites using SharePoint Designer.

This is a problem with SharePoint Designer. We have to install Service Pack 1 for SharePoint Designer. (KB 2817441)
After Restart the server, we can OPEN the Office 365 SharePoint Site Using Designer.

Sunday, March 22, 2015

Edit Office 365 site using SharePoint Designer

By default We cant edit office 365 site using SharePoint Designer.
We have to go to SharePoint admin center and enable it.

Go to admin Center
Check Whether SharePoint Designer is enabled, but still we cant see the SharePoint designer under site settings

Go to Admin Centre

Go to SETTINGs from the left panel


Enable CUSTOM SCRIPTS

Then check with SIte Settings. Still we can't see it. We have to wait few hours until SharePoint completes it. :)

Monday, March 9, 2015

Enable RMS in SharePoint 2013 Online using Azure RMS

We have to enable RMS for a document in SharePoint Online. First when we go to the Library settings there is no section called "Information Rights Management".


We have to enable it using Admin Center.

Click Rights Management in the left panel
activate RMS.
Once activated, go to the Library Settings

we can see new section called, "Information Rights Management"
We can set new "Policy Name" and "Description"


Once saved the RMS, when use opens the document it is assigned to RMS.

we can set the document library to "not to open in browser"
when user opens the document, it will be displayed the message.
It will inform the user regarding the RMS settings.


though User download the document, it will be prompt the credentials.








Monday, March 2, 2015

SharePoint admin service is not starting

1.    Open Group Policy Editor. From startà search box, type in gpedit.msc
2.    Computer ConfigurationàWindows SettingsàPublic Key Policies àCertificate Path Validation Settings
3.    Click on the “Network Retrieval” tab
4.    Check the “Define these policy settings” and uncheck the “Automatically update certificates in the Microsoft Root Certificate Program”
5.    Click OK



Wednesday, January 28, 2015

Deploy SharePoint Solution Without Adding New List Instance

When we deploy SharePoint solution to the environment by default it delete old LIST and deploy new LIST. When doing so the users are loosing all the ITEMS with the LIST.


We have a List with 4 columns. When we need to add new column without loosing data, we have to change a property in the LISTINSTANCE.
after adding new column, we have to get PROPERTIES in the LISTINSTANCE.
Then we have to change the "Deployment Conflict Resolution" as "NONE"
After that we can deploy the solution.
It will add new COLUMN to the LIST without data deletion.
Also, we add new COLUMN as REQUIRED, but for OLD items it was not an issue.
But for a New ITEM it is mandatory.




My Masters