The type or namespace name ‘DataContract’ could not be found (are you missing a using directive or an assembly reference?

Leave a comment


just add:

add System.Runtime.Serialization in references

limit the iterations in foreach loop c#

Leave a comment


Hi All,

Sometimes there will be a huge data to loop through but you need to check for few iterations only say 10. In that case items collections in foreach loop contains a built in method to limit the iterations.TAKE

foreach (Object o in collection.Items.Take(10))

{

     ……

}

Ref: https://msdn.microsoft.com/en-us/library/ms132403(v=vs.110).aspx

Take<T>

Returns a specified number of contiguous elements from the start of a sequence. (Defined by Enumerable.)

Five fascinating revelations from ‘Becoming Steve Jobs’

Leave a comment


onetidbit:

Read

Originally posted on 9to5Mac:

Steve Jobs Fearless GeniusBecoming Steve Jobs, the new biography of Steve Jobs by Brent Schlender and Rick Tetzeli, will be officially released tomorrow by Crown Business/Penguin Random House, and is currently available as a pre-order from Amazon ($12+) and Apple’s iBookstore ($13). Here are just some of the interesting revelations found inside, including some details regarding Jobs’ evolving attitude towards the media.

Jobs’ return to Apple was almost certainly not a strategic takeover. Despite speculation that Steve Jobs may have strategically orchestrated a takeover of Apple during his sale of NeXT — a view shared by Bill Gates and former Apple CEO Gil Amelio — the book suggests that Jobs was truly uncertain about his continued involvement with the company. Avie Tevanian and Jon Rubinstein, “the two men whom Steve trusted the most at Apple… agree that Steve did not intend to become Apple’s CEO,” and that they didn’t think they…

View original 643 more words

Get current logged user in list event receivers?

Leave a comment


SPUser user = properties.Web.CurrentUser;

Sort Datatable values in Ascending Order

Leave a comment


NameSpace:  System.Data

We need to use DataView.Sort Property

Let us consider you already have a Datatable dt with some content in it and you want sort it in ascending order by the column Rollno

Then…

DataView dvt=new Dataview(dt);

dvt.sort=”RollNno ASC”;

//then again assign that view to datatable dt.

dt=dvt.ToTable();

Reference: https://msdn.microsoft.com/en-us/library/system.data.dataview.sort%28v=vs.110%29.aspx

service bus unable to uninstall issue problem in sharepoint 2013 Workflow related

Leave a comment


Sometimes, you need to uninstall Windows Service Bus 1.0 and it will not disconnect “Leave the Farm”

Follow steps:

1) Open Run and Type regedit

Delete the \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Service Bus folder

Then go and do uninstallation it will be perfect

Mapping document icons using SPUtility.MapToIcon programatically in SharePoint 2013

Leave a comment


Hi,

Using document library when we upload a document suppose if we upload a pdf document . You can see a small pdf icon.

Based on the document type the icons will map in Default Document Library in SharePoint 2013.

Similarly we need to get that while doing programmatically for that we can make use of  SPUtility.MapToIcon

The original location of icons in the server will be at: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\IMAGES

while in program the path will be like:http://doaminname:portnumber/_layouts/images/icdoc.png

string icon = SPUtility.ConcatUrls(“/_layouts/images”,SPUtility.MapToIcon(item.Web, SPUtility.ConcatUrls(objSPListItem.Web.Url, objSPListItem.Url), “”, IconSize.Size16));

Use Image Control in ASP.net

then

assign the

Image.Url=objSPListItem.Web.Url + icon;

Then you will get the icon related to the document type.

Note: SPUtility in sharepoint 2013 is a wonderful class which includes many useful methods.

Visit for more info: SPUtility

Older Entries

Follow

Get every new post delivered to your Inbox.

Join 276 other followers

%d bloggers like this: