Friday, August 15, 2014

SharePoint 2013 - Activate Feature using Client Object Model

You can activate the Site Collection Features / Site Feature using Client Object Model (CSOM) . All you need to do is to put the below code in the script editor or Content Editor Webpart in you page.

 <script src="https://Servername/Shared%20Documents/jquery-1.8.3.min.js" type="text/javascript"></script>

<script type="text/javascript">
var context = SP.ClientContext.get_current();
$(document).ready(function () {
var site = context.get_site();
context.load(site);
context.executeQueryAsync(function () {
site.get_features().add("Enter Feature ID Here", true, 0);
context.executeQueryAsync(Sucess() {
function("Sucess!");
},
function(sender, args){
alert("Error : " + args );
});
},
function (sender, args) {
alert("Oops. Sorry! " + args);
});
});
</script>

 

Happy Browsing!
Relax..

 

Wednesday, July 2, 2014

SharePoint - Troubleshoot / Help 404 error in SharePoint

Troubleshoot steps if you are getting 404 error for the site collection and central admin is loading properly. 404 generally occurs when your request is hitting the server and server is unable to find/servers your requested page.
  1.  Make sure SharePoint services are running, restart IIS web sites have started,     IIS application pools have started and Database are up
  2. Check ping is receiving reply from network.
  3. Try accessing the site by server name with full domain and port number.
  4. Check the Alternate Access Mapping is correctly configured.  IIS can handle the connection to the root site, but without this information added, SharePoint cannot properly handle the requests to your other site collections.
  5. Check your permission level in the site collection or farm and Database.
  6. Check the http://ServerURL/_layouts/settings.aspx is loading properly. Come times landing page may have error.
  7. Check the authentication is enabled in the IIS for windows and default logins.
  8. Check the Firewall port is open to accept request at 80 port. Open firewall settings. Then search for something like - Allow program or feature to allow through firewall. If in the list World Wide Web services (HTTP) is unchecked, check it and restart the system
  9. Check the HOST file entry for the name/ URL / typos
  10. Check the bindings in the IIS for the port listener.Make sure the default site is stopped. If you see bindings that look like the following:
    ID 1: Bindings: *:80
    ID 2: Bindings: www.yoursite.com:80
  11. Check the Event Viewer log - this will help for most of the issues debugging. 
  12. Check the ULS log is any authentication is failing inside. Some times bin folder or app folder may be locked down.


    If this issues occurs intermittently then probably you need to check this article for remounting DB.
Happy Browsing!
Relax..

Wednesday, June 25, 2014

JavaScript: Easy way to Cache objects in Local Storage/ Client Browser in JavaScript

Here is a easy way to store and retrieve  your java script objects ( even more than 4KB) in the local /Client browser . I'm using jStorage for this method and jStorage supports storing Strings, Numbers, JavaScript objects, Arrays and even native XML nodes. jStorage also supports setting TTL values for auto expiring stored keys and - best of all - notifying other tabs/windows when a key has been changed or publishing/subscribing to events from the same or another tab/window, which makes jStorage also a local PubSub platform for web applications.


 < script src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js">
< script src="http//code.jquery.com/jquery-1.9.1.min.js">
< script src="jstorage.js">


< script type="text/javascript">
var testObject = "test123"; /* Sample Data. You can fetch the objects from Server and store it*/

// Check if "key" exists in the storage
var value = $.jStorage.get("key");
if(!value){
    $.jStorage.set("key",testObject);
}
< /script >


Here you go, Now its easy to store to the cache with bigger data. hope this helps.
Article Source and .js file available at : www.jstorage.info

Happy Browsing!
Relax..