Get Yahoo Weather and Parse it in C#

Posted Yorum yapınSharepoint 2013, Yahoo içinde yayınlandı

Here’s a code i wrote for a sharepoint 2013 visual webpart which retrieves Istanbul’s temperature and condition text from Yahoo Weather (YQL) in JSON format and parsing.

string results = "";
using (WebClient wc = new WebClient())
results = wc.DownloadString("*%20from%20weather.forecast%20where%20woeid%3D2344116&format=json");

dynamic jo = JObject.Parse(results);
var items =;
var code = items.code;
var temp = items.temp;
var text = items.text;

Console.WriteLine(code + " - " + temp + " - " + text);


SharePoint 2010 Deployment Problem: Error occurred in deployment step ‘Retract Solution’

Posted Yorum yapınSharePoint 2010 içinde yayınlandı

Today while i was working on a SharePoint 2010 project,i came across this problem:

“Error occurred in deployment step ‘Retract Solution’: C:\Windows\Temp\{some guid with packagename}.wsp could not be created because the contents could not be found under id {some guid} in the configuration database.

I was trying to figure out what the problem might be then i realized it was my fault :))

I stopped SharePoint 2010 Timer service before deploying.So starting the Timer Service from services.msc resolved my problem.

Limit NewsFeed to Display Latest 5 Posts in SharePoint 2013

Posted 5 YorumSharepoint 2013 içinde yayınlandı

I was having an issue to retrieve latest posts from newsfeed,lets say take 5 of them.Tried everything,but newsfeed webpart didnt support filtering according to my need.

So i tried a “css-trick” code i found over the internet and improved it to my needs:

function get5posts() {
var limit = 5;
$("#ms-feedthreadsdiv .ms-microfeed-thread").each(function (i) {
if (i >= limit) {

The code above shows only 5 posts on page load.But what happens if you add more in newsfeed? The 5 item limit exceeds and you need to call a function to restrict it to 5 item:

Call get5posts() in page load event:

$(document).ready(function (e) {

Afterwards call it again if user clicks on post reply button:

$("#ms-postbutton").on("click", function () {

This will limit NewsFeed to 5 posts only.

Nice Trick!

Considerations after Backup & Restore in SharePoint

Posted Yorum yapınSharepoint 2013 içinde yayınlandı

These are what i experienced on some of the projects i have worked on:

1) Scripts,Styles,Fonts,Layouts needs to be published.Because they stay as draft items in your “_catalogs/masterpage”

2) The lists that use filtering needs to be updated.Sometimes it bugs out.

3) If you have used NewsFeed in your portal,its contents need to be deleted from MicroFeed special list.Just click on the guid item and it will show the users posts.This is important because people will see users’ posts from the test environment

4) Never ever use SPContext.Current.Web.List(“blabla”) to access lists.Its one of the evil reasons your users getting permission problems.

5) If you have used database connections in your code,update your web.config.Backup&Restore doesnt backup your web.config

6) Always backup the live server through powershell script in case something goes wrong and you may need to restore later.

Will update this post as i see fit in the future.

Get Attachments using SPServices in SharePoint 2013

Posted 5 YorumSharepoint 2013 içinde yayınlandı

[sourcecode language=”javascript”]


operation: "GetListItems",
async: false,
listName: "listname",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
listName: "listname",
ID: $(this).attr("ows_ID"),
completefunc: function (xData, Status) {
$(xData.responseXML).find("Attachments").each(function() {


But theres a much more better way to do it,Thanks to Marc:

[sourcecode language=”javascript”]
var p = $().SPServices({
operation: "GetListItems",
listName: "listname",
CAMLQueryOptions: "<QueryOptions>" +
"<IncludeAttachmentUrls>TRUE</IncludeAttachmentUrls>" +

p.done(function() {

$(p.responseXML).).SPFilterNode("z:row").each(function() {

var attachments = [];

var att = $(this).attr("ows_Attachments");
if(att !== "0") {
attachments = att.split(";#"); // Now you’ll have an array of attachment URLs
} else {
// att will be "0", indicating that there are no attachments



Have fun 🙂

Embedding UserControls to HTML page created by Design Manager

Posted Yorum yapınSharepoint 2013 içinde yayınlandı

The design crash after you embed 2 or more User Controls in a html file.I have been figuring out a way to solve that problem today.

You can register User Controls using this statement:

[sourcecode language=”csharp”]
<!–SPM:<%@Register TagPrefix="UC" TagName="SampleUC" src="~/_controltemplates/SampleIntranet/SampleUC.ascx"%>–>

Normally you can use;

[sourcecode language=”csharp”]
<!–MS:{UserControl registration}–>

but when you add 2 user controls same way,design crashes.So you need to close the MS statement using “ME”.

Here’s how you can do it:

[sourcecode language=”csharp”]
<!–MS:<UC:SampleUC runat="server" id="SampleUCID">–>;
<!–MS:<UC:SampleUC2 runat="server" id="SampleUCID2">–>

Hope that fix helps you

Problem & Solution: This solution contains no resources scoped for a Web application…

Posted Yorum yapınSharepoint 2013 içinde yayınlandı

When i tried to deploy a webpart to a webapplication using both PS and Central Administration,i got the following warning:

This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.

It tried to deploy it to GAC which i didnt want.Because it needs to be deployed to a WebApplication in my farm

Solution is;
Started Visual Studio and the project,opened Package.Template.xml in an editor and edited the line in yellow:

DeploymentTarget property needs to be set as “WebApplication”.Even though i changed it via project properties,it kept changing to GACDeployment so i had to edit Package xml.Just to be sure.

After deployment i got to choose the webapplication where i want it deployed.

Hope it helps

How To Start PhoneGap? #1 – An Explanation

Posted Yorum yapınPhoneGap içinde yayınlandı


The Industry isnt the same its 5 years ago.Nowadays every company,individual or a community MUST have a mobile app or mobile website.

Since our option here is building Mobile Apps,I would like to help you get started with PhoneGap easily and fast enough.

Before we start talking about what needs to be installed and which apps and frameworks we need to use developing,I would like to talk about wrong things you know about PhoneGap.

Facts you know wrong or half-true about PhoneGap #1: PhoneGap isnt a WYSIWYG Editor

Clearly,every “NATIVE LOVER” neither developed a single line of Hybrid App nor knows about it;  thinks like that.They think as if you have an editor like Visual Studio or Eclipse or whatever WYSIWYG editor you’re using to develop apps.Thats not true.You can use whatever HTML-supported editor you want even a NotePad can help you build a Hybrid Mobile App with PhoneGap.PhoneGap Apps are HTML/JS oriented apps.

Since i cleared the way from misunderstandings,i better tell you what PhoneGap is before you leave my blog.

PhoneGap is divided into 2 parts: Packager and Framework

Packager helps you to build and debug apps according to the platforms you wish to be published such as Android,iOS,Windows Phone,Blackberry.
Framework is called Apache Cordova.Cordova help you to access platform-specific or common elements such as Camera,GPS and so on…

The apps built using PhoneGap Packager uses Cordova at backend.Its a device-specific set of scripts that uses Native coding backend and invokes features of the phone.

Facts you know wrong or half-true about PhoneGap #2: PhoneGap runs slow

Its not that something to do with PhoneGap but the system itself!

Lets compare 2 kind of apps: Native and PhoneGap

In your Native App,you dont use any single line of code or visual element.Just a blank screen.
How does native apps work? First the codes compiled line by line and then visual elements (if any and no error on debug) being put in the window.Then the emulator runs and displays our app.

Now lets take a look at PhoneGap!

How PhoneGap actually works: Normally to access the Native specs,theres a secret Native App Template built on packaging.Yes! What did you think? How else would a javascript access Native specs without invoking backend Native Codes.So till debugging everything works just like a Native App.After the app works,first the scripts are being called,rendered and then HTML elements being drawn in a WebBrowser component that fills the screen.

See the difference? Its because it renders 2 times.1 for Native and 1 for HTML/JS files.So whoever thinks its slower than Native,yes you’re right but no other Hybrid alternative can change that.Its because of the system design.Every Hybrid app runs inside a Native App.

I will talk and update this series often so stay in touch