Pages

November 23, 2012

MS SharePoint App for Win Phone

SharePoint

Microsoft just released a preview version of its 'app' for SharePoint social features on Win Phone.
First, the idea itself is good: this is the 'Facebook' face of the enterprise, where employees can (according to Microsoft):
• Create new status posts
• Add comments to ongoing discussions
• Read and “like” your colleagues’ posts
• @mention a colleague directly 
• Use #hashtags
• Upload pictures
• Discover people profiles
• Work with followed documents
12ac6e5e-d6d8-4d3d-b127-13693c6cd00b
Now this is good isn't it? yes.. BUT..(there is always a but!!)..
But according to reviews so far, apparently its only meant for SharePoint 2013, it lacks the the required functionality to run across SharePoint 2010 as it shows connection errors. Users got confused since this piece of information is not mentioned in the app's description.
That put a negative image over the the app, and the review so far is 2 stars out of 5.

The good news is that its still under development, and Microsoft should really cover up for these holes really good when the finally release their stable version. Should this come true, they should make similar app for iPhone and Android devices.

Here is the link to the app.

September 19, 2012

Embed Flash SWF resources inside web part in SharePoint 2010


SWF Flash in SharePoint 2010

If you are looking for a quick and easy guide on how to embed shockwave and flash files (.swf) into web Web parts then look no further!
As it is a bit different to embed .swf files (and other resources) into SharePoint 2010 than it was in SharePoint 2007, I split the procedure into 2 parts: the Visual Studio part and the SharePoint part.

 The Visual Studio Part:

1. Copy the resource file (.SWF) file inside the Visual Studio project folder directly, or put it in a custom folder.

2. Select the .swf file -> properties -> set the build action property into ‘Embedded Resource’

3. Now, construct the resource FILE-PATH as: ProjectName.FolderName.FileName.Extension
Example:
My project’s name is: ‘EmbedResources’, and the file ‘Clock.swf’ is directly under the project. Then the FILE-PATH will be: “EmbedResources.Clock.swf”

4. In AssemblyInfo.cs put the following line (use the FILE-PATH from point 3 above):
[Assembly: System.Web.UI.WebResource(FILE-PATH, “application/x-shockwave-flash”)]
Example:
[assembly: System.Web.UI.WebResource("EmbedResources.Clock.swf", "application/x-shockwave-flash")]


5. In Web part code file, you can put the following code inside the RenderContents() method:
(use the FILE-PATH from point 3 above)
This.Page.ClientScript.GetWebResourceUrl(base.GetType(), FILE-PATH)
Example:
string path = this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "EmbedResources.Clock.swf");

6. To display the flash put the following script:
string str = string.Concat(new object[] {
"<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=", "120", " height=", "120", "> <PARAM NAME=movie VALUE=\"", path,
"\"> <PARAM NAME=wmode VALUE=\"Transparent\"><PARAM NAME=quality VALUE=high> <EMBED src=\"", path,
"\" quality=high wmode=\"transparent\" width=\"", "120", "\" height=\"", "120",
"\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></EMBED></OBJECT></p>"
});
writer.Write(str);


Now install the web part solution into your SharePoint site, but we are not there yet!




 The SharePoint Part:

These are pretty much requirements, make sure you check every point here in order for the swf file to actually run:


1. Install Adobe (formerly Macromedia) Flash or Shockwave player for your browser.

2. Enable Active-X components on your browser

3. SharePoint 2010 is a little bit acts as ‘defensive’ against browser scripts and files. To overcome this, go to Central Admin -> App. Manag. -> Manage Web App. -> SharePoint 80 -> General Settings -> General Settings -> set the Browser File Handling to “Permissive”


Now, you can add the web part to page and enjoy the animations J


Note: For embedding resources inside Sandboxed web part, Joel Jeffery a good post here:



September 8, 2012

Snow on your SharePoint!




How about bringing winter right into your SharePoint site?
I found this cool javascript project made by Scott Schiller here. According to project website, there are 2 files, either one can be used:

snowstorm.js --> is the general code
snowstorm-min.js --> optimized, minified version (~40% smaller 'ice')

Now I summed up the steps required to implement this effect on SharePoint 2010/2007: Before you begin, you have to download the 2 files "snowstorm.js" and 'snowstorm-min.js" from the site, then upload these files into the SharePoint site such as in Style Library or a custom folder in it.
There are 2 methods to run snowstorm effect in SharePoint 2010 and 2007:


Method A: Editing the Master page

Use this method when you want the snow effect over all site pages.

1) Using SharePoint Designer, Open your master page file such as 'V4.master' for SP2010 or 'default.master' for SP2007, or you can a specific master page and name it "snowstorm.master".

2) Within the <head> tag of the master page, add a script reference to the javascript file just above the content place holder named "PlaceHolderAdditonalPageHead" (and above your custom CSS references, if applicable) as follows:

<script src="/Style%20Library/snowstorm.js" type="text/javascript"></script>

3) Save the changes to master page. If this a specific master page then apply it to a specific site page.


Method B: Editing the ContentEditorWebPart

[as done by Shoban in here]
Use this method when you want the snow effect over a specific page such as only the home page.

1) Open your SharePoint page and add a Content Editor WebPart.

2) Edit the HTML Source for the content Editor WebPart, add the following code:

[sourcecode language="javascript"]
<script src="/Style%20Library/snowstorm-min.js"></script>
[/sourcecode]

3) set the Chrome Type for the Web Part as 'None', and set Chrome State to 'Minimized'.

4) Save and Exit Edit mode.


After you finish with either of the methods above, open the site page and enjoy the snow. Thats it!

Note: select a suitable theme or customize one so that the snow particles shows clearly.


The Result..



Do you think there are other cool effects that can be applied to SharePoint? please share ideas.



August 15, 2012

How to find which W3WP.exe process to debug

Problem:

When you set break points in SharePoint code, you need to attach the debugger to the w3wp.exe process that is responsible for running your code. The problem is that there are multiple instances of this process, so which one to attach the debugger to?



Solution:

Run the Windows Task Manager -> View -> Select Columns -> Check ‘PID’ and ‘Command Line’ columns. 
In Processes tab you will see the available w3wp.exe processes along with their IDs and command lines.



Pick the one with a command line referring to ‘SharePoint-80’. That will be your main SharePoint process so get the PID (example: 6512).
Now in Attach to a process windows in Visual Studio, select the process with the aforementioned PID (6512).


July 30, 2012

A reason for blog posts delay



I would like to apologize for the delay on blog posts.. 

I didn't write any post during the past period as I didn't have the time and the resources to blog. The reason for this is I got my resettlement from Baghdad, Iraq to San Jose, CA. 

The downside: a 2 days long trip, then another 9 days to settle in an apartment, do a lot of paperwork, and get a reliable high speed Internet. It is indeed a very busy period that left me isolated from my tech work.
The good part: I am finally living in the Silicon Vally where all the giant tech companies are headquartered. 
Thank you!

Ibraheem

June 26, 2012

Quick guide to dispose objects in SharePoint




Ever wanted a quick reference on what to or not to dispose in SharePoint?
This is the my idea about such a guide.

How to dispose?
You can use the Dispose() method, or the Using keyword context

  
What to dispose?
to ease reading, in general: Dispose red, keep green!.

Dispose when you have: new, openWeballWebs,Webs

Do NOT dispose when you have: SPContext, RootWeb, ParentWeb

Also from latest version of SPDisposeCheck tool, this is a reference list of Do Not Dispose Rules checked:
SPListEventProperties.Web
SPWebEventProperties.Web
SPItemEventProperties.Web
SPItemEventProperties.ListItem.Web
SPItemEventProperties.Web.Site
SPItemEventProperties.ListItem.Web.Site
SPFeatureReceiverProperties.Feature.Parent
SPList.ParentWeb&SPListEventProperties.List.Web
SPWeb.ParentWeb
SPContext.Site&SPContext.Current.Site
SPContext.Web&SPContext.Current.Web
SPSite.RootWeb
SPControl.GetContextWeb(..)
SPControl.GetContextSite(..)
Microsoft.SharePoint.Administration.SPSiteAdministration.OpenWeb()
Microsoft.SharePoint.SPItemEventProperties.OpenWeb()

You can always check the latest version of SPDisposeCheck utility at: http://archive.msdn.microsoft.com/SPDisposeCheck


June 20, 2012

Ibraheem.says("Hello World!");




Hello everybody!
My name is Ibraheem and I am a passionate software developer from Iraq.
  
I started this blog because I believe in sharing of useful ideas. Technology world is becoming tougher each day with piles of layered techniques and programming stacks. We as developers are in continuous demand for useful resources to ease our tasks/jobs. As I have benefited a lot in countless times from tech blogs, I decided to start one myself and publish content that I hope to be useful to readers.
This blog will be about programming in .NET and SharePoint server. Codes on other languages and technologies will also join the content as well.
Your feedback is warmly encouraged! I really welcome and appreciate comments, recommendations, and even criticism as it is an important way to deliver high quality content and make our minds ‘work’ actively! You can comment on any post, or email me directly at: engineeribraheem@gmail.com

Ibrhaeem