Monthly Archives: December 2016

HSC (XII) Physics Chapters Sub Topics

This is the second post in this category. Here I am sharing the chapter-wise sub-topics of HSC (XII) Physics of Maharashtra Board.

HSC (XII) Physics Chapters sub-topics

Advertisements

How to identify whether a site is based on SharePoint or not

We often come across many sites on Internet or intranet and we always want to know that whether the site is based on SharePoint or not. So, in this article I am going to list all possible ways to identify if a site is based on SharePoint or not.

  • The simplest way is to check the structure of the site i.e. folder structure or different pages. This pattern may show you a SharePoint Publishing site (Pages/Pagename.aspx or default.aspx). You can also search for /SitePages library by typing in the URL.
  • If the site if of high importance OR if the site is very famous, then it will definitely be published as Microsoft case study : http://www.microsoft.com/casestudies
  • As we know, SharePoint on-premise server is hosted on IIS (Internet Information Server), so we can check using HttpResponse or by some other tools that which hosting server is used for a particular site.
  • In Chrome or Firefox browsers, open up console and view JavaScript’s files used on the page. If you see init.js, core.js etc., then it’s definitely a SharePoint site.
  • Right click on any page and see for “view source”. Click on that and search for meta tag. If it’s a SharePoint site, then it will definitely have:-
    <head><meta name=”GENERATOR” content=”Microsoft SharePoint” />
    src=”/_layouts/1033/init.js”
  • If it’s a SharePoint site, then it must be calling web services in it. You can call any of the SharePoint OOTB web services (if it doesn’t open, then you will see the legendary “Error page” or “Something went wrong” page). Just access any of the web service present inside the “_layouts” folder.
    E.g. – <<Site_Url>>/_layouts/lists.asmx

If you will check or test any of the above one or two points, then definitely you can be say that whether site is based on SharePoint or not.

CASE STUDY: –

Interestingly, while browsing the Indian Income Tax Department website (http://incometaxindia.gov.in/pages/default.aspx), I found that this site is based on SharePoint….voila !!

To confirm on this, I tested using the above points and below are my observations: –

1) Clicked on view source on the home page and searched for meta tag: –

it-1-meta-tag

 

 

2) Then I searched for init.js, _layouts based structure and other files related to SharePoint:-

it-2-init-js

 

 

3) Lastly, I checked the internal web service of SharePoint by typing this URL in browser – http://incometaxindia.gov.in/_layouts/lists.asmx , and see below the SharePoint Error page:-

it-3-error-page

 

 

 

Do you still need proof? Well enough, I know its SharePoint site now.

Competitive Exams for school going students (class – 5th to 10th, 11th & 12th class)

Hello,

This blog is something unique and not related to SharePoint. This blog is related to school going students who are preparing or wish to prepare for cometitive examinations. This blog will give you complete information about the various competitive exams. Please click on below links to get the details:-

competitive-exams-for-further-studies-after-12th

engineering-entrance-exam-dates-2017

national-exams-academics

Important Code Snippets

  1. .NET Regex to express positive numbers with decimal
    @”^[0-9]{1,20}(\.[0-9]{1,6})?$”
  2. SharePoint People Picker Control
    <SharePoint:PeopleEditor />
  3. ASP.NET Textbox Textmode=”Number” – RegularExpressionValidator
    <asp:RegularExpressionValidator ID=“RegularExpressionValidator1” runat=“server” ControlToValidate=“tbAccount” ErrorMessage=“Please Enter Only Numbers” ForeColor=“Red” ValidationExpression=“^\d+$”>
  4. ASP.NET Set the value of a textbox textmode=”date”
    txtbox.Text = DateTime.Today.ToString(“yyyy-MM-dd”);

Getting the Reply Count for a SharePoint Discussion (Discussion List)

SharePoint’s Discussion lists are sort of like Document Sets, in that the original post is a Discussion Content Type which inherits from Folder and the replies are the Message Content Type, which inherits from Item. So there aren’t any Documents involved, but Discussions (Discussion list) are once again Folders.

I was working on task to get the replies of a Discussion in a Discussion list.I implemented the following code using SPServices and was able to get the reply count and replies of a particular discussion.
(ItemCount is that mysterious count of replies I was looking for :))

<!DOCTYPE html>

<html lang=”en” xmlns=””>

<head>
<meta charset=”utf-8″ />
<title>Governance & Nomination Committee</title>

$(document).ready(function() {
var siteURL = _spPageContextInfo.webServerRelativeUrl;
//alert(siteURL);
var discussionListName = “Mergers and Acquisition Committee”;
$().SPServices({
webURL: siteURL,
operation: “GetListItems”,
async: false,
listName: “Mergers and Acquisition Committee”,
CAMLViewFields: “”,
completefunc: function(xData, Status) {
$(xData.responseXML).SPFilterNode(“z:row”).each(function() {
var ItemCount = $(xData.responseXML).SPFilterNode(“rs:data”).attr(“ItemCount”);
//alert(“ItemCount:=” + ItemCount);

var subject, createdOn, modifiedOn, createdOnDate, modifiedOnDate, createdOnTime, modifiedOnTime, discussionURL;
if (ItemCount > 0) {
subject = $(this).attr(“ows_Title”);
createdOn = $(this).attr(“ows_Created”);
modifiedOn = $(this).attr(“ows_Modified”);

createdOnDate = convertDateTime(createdOn, “date”);
//createdOnTime = convertDateTime(createdOn, “time”);

modifiedOnDate = convertDateTime(modifiedOn, “date”);
modifiedOnTime = convertDateTime(modifiedOn, “time”);

var fileRef = $(this).attr(“ows_FileRef”);
//alert(“fileRef:=” + fileRef);
var filepath = getFilePath(fileRef);
//alert(filepath);
var RepliesCount = getDiscussionRepliesCount(discussionListName, filepath, siteURL);
//alert(RepliesCount);

discussionURL = $(this).attr(“ows_EncodedAbsUrl”);
//alert(“discussionURL:=” + discussionURL);
//discussionURL = discussionURL.substr(0, discussionURL.lastIndexOf(“/”));
//alert(“discussionURL:=” + discussionURL);
var disitemURL = discussionURL + “/DispForm.aspx?ID=” + $(this).attr(“ows_ID”);
$(‘#ulMergersNAcquisition’).append(“Title : ” + subject + “” + “Created On : ” + createdOnDate + “” + “Last Updated : ” + modifiedOnDate + “, ” + modifiedOnTime + “” + “Replies : ” + RepliesCount + ““);
} else {
$(‘#ulMergersNAcquisition’).append(“There are no items to show.”);
}

});
} //End of complete function
}); //End of SPServices
}); //End of Doc Ready

function getFilePath(fileRef) {
if (!fileRef) return;
var m = /;#(.*)$/.exec(fileRef);
if (m) {
return m[1];
}
}

function getDiscussionRepliesCount(list, filepath, siteURL) {
//alert(‘In getDiscussionReplies :=’ + filepath);
var i = 0;
var finalReplies;
$().SPServices({
webURL: siteURL,
operation: “GetListItems”,
async: false,
listName: list,
CAMLViewFields: “”,
CAMLQueryOptions: “”,
CAMLQuery: “” + filepath + “”,
completefunc: function(xData, Status) {
$(xData.responseXML).SPFilterNode(“z:row”).each(function() {
//alert(xData.responseText);
if (i == 0) {
var replies = $(this).attr(“ows_ItemChildCount”);
finalRepliesCount = replies.split(‘#’)[1];
//alert(finalRepliesCount);
i = 1;
}
});
//return finalRepliesCount;
} //End of complete function
}); //End of SPServices
return finalRepliesCount;
}

function convertDateTime(x, formatter) {
var months = [‘January’, ‘February’, ‘March’, ‘April’, ‘May’, ‘June’, ‘July’, ‘August’, ‘September’, ‘October’, ‘November’, ‘December’];
var shortMonths = [‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’, ‘Jul’, ‘Aug’, ‘Sep’, ‘Oct’, ‘Nov’, ‘Dec’];

// split up date and time
xDate = x.split(” “)[0];
xTime = x.split(” “)[1];

// split off the hour from the minute/second
xMinSec = xTime.split(“:”)[1];
xHour = xTime.split(“:”)[0];

// set the am or pm suffix
if (xHour > 12) {
ampm = “PM”;
xHour -= 12;
} else if (xHour
</head>

<body>
<ul id=”ulMergersNAcquisition”></ul>
</body>
</html>

Important points to know about Site Columns and Content Types in SharePoint 2013

In one of my recent projects of SharePoint Online (Office 365), I need to create the site architecture starting with creation of Site Columns and Site Content Types. To give you the glimpse of the project, it involved roll-up and roll-down of data from 300 sub-sites under the root site collection. So, I decided to use Content Search web-part which allows to roll-up the data and by modifying the queries, we can roll-down the data too.

What I learnt –

  1. Use OOTB site columns as much as possible, do not create your new site columns if already provided by SharePoint. However, if OOTB columns doesn’t suits your requirement, then you can create new custom column (For E.g. – OOTB “Due Date” columns is of Date type, so if you wish Date and Time type column then you cannot use this OOTB column)
  2.  Always create a separate group for your site columns and content types.This will help you to filter the columns and content types.
  3. Many times, we make columns as Hidden for one list/library and then try to add the same columns in other list/library which we find is not available. So, before adding a site column in any list/library or any content type, make sure that the column is not hidden at top level.
  4. After migration or after creating a site template, your site is not getting created (assuming your site having workflow also), then change your .wsp file to .cab file and check the XML files. Try to delete the duplicate entries of site columns and content types which are created twice.

Check Logged-in User in SharePoint Group using SPServices

$(document).ready(function() {
var userName = $().SPServices.SPGetCurrentUser();
$().SPServices({
operation: “GetGroupCollectionFromUser”,
userLoginName: userName,
async: false,
completefunc: function (xData, Status) {

if ($(xData.responseXML).find(“Group[Name=’Site Members’]”).length == 1) {
alert(“login inside of the Group user”);
}
else {
alert(“login outside of the Group user”);

}
}//End of completefunc
});//End SPServices
});//End Doc Ready