Skip to main content

Hans Muster's Library tagged codesnippet   View Popular

17 Nov 09

CodeProject: ExifLibrary for .NET. Free source code and programming help

To extract Exif metadata from a JPEG/Exif image, create an instance of the ExifData class with the path to the image file. The ExifData class reads the APP1 section, and extracts all Exif tags and also the embedded thumbnail (if any). For ease of use, this Exif library converts Exif tags to either .NET native types or custom classes. Date fields are returned as DateTime structures, GPS coordinates are wrapped with custom GPSLatitudeLongitude classes, etc.

www.codeproject.com/...ExifLibrary.aspx - Preview

exif library programming c# codeproject free codesnippet

02 Nov 09

NCDevGuys' ramblings on connected bits.... : InfoPath : Retrieve and Send Data from/to a SharePoint 2007 Workflow

Yes, I know this title sounds a bit odd, and the real title should be ‘When you are using an InfoPath task edit form, how do you use InfoPath data connection bindings to both retrieve and send data to a SharePoint 2007 workflow?’

So one day I was building an InfoPath 2007 task edit form and I wanted to send data to this form from inside of my workflow by using something like:

taskProperties.ExtendedProperties[“txtProductDescription”] = “Product ABC”;

I implemented an ItemMetadata.xml file with an ‘ows_txtProductDescription’ field, added a secondary data connection for it in my InfoPath form and followed all the normal steps and when I opened the form when my task was created, the data was there as expected.

However, what I didn’t realize was that when I closed the form and completed the task and then re-opened the form just to look at my previous settings, the data was gone! The form appeared as if it were a new form with default settings. To make matters worse, inside of the workflow I discovered that I could not use the task After properties to get the data out of the txtProductDescription field, it was always null. And this is where my multi-day odyssey of searching for the answer began.

To make things simple here, I’m just going to start with a simple form that has no binding and show you how to set things up. I hate to admit it took me several days and talking to several people to figure this out, so I hope it helps you shorten your path to a solution also.

Technologies Used:

* Microsoft Office SharePoint Server 2007 Enterprise Edition, SP1
* InfoPath 2007 – Browser enabled forms
* Visual Studio 2008 SP1 / C#

blogs.msdn.com/...-sharepoint-2007-workflow.aspx - Preview

infopath sharepoint workflow codesnippet

22 Oct 09

CodeProject: Create Custom Application Block Using .Net Enterprise Library. Free source code and programming help

"This white paper is written in a view to help developer to create custom application block using .net Enterprise Library."

www.codeproject.com/...CustomAppBlock.aspx - Preview

enterprise library codesnippet c#

20 Oct 09

Chaks' Corner | Using KeywordQuery to search in your SharePoint site

There are various ways that you can query the Search Service in your SharePoint site:

1) Using the Search Web Service

2) Using the SharePoint Object Model

There are yet again two ways you can use the Search, using the Object Model:

i) KeywordQuery

ii) FullTextSqlQuery

I think it is a good option to use Object Model when you want to customize the Search (mostly in your WCM websites), and KeywordQuery comes in very handy!

Using KeywordQuery to search is pretty simple! (provided you have set up your Search properly)

www.chakkaradeep.com/...h-in-your-SharePoint-site.aspx - Preview

moss sharepoint search development c# codesnippet

01 Sep 09

C# - UNC-Pfad ermitteln

Mit diesem Snippet kann man einen UNC-Pfad aus einem Pfad erstellen lassen.
Sollte es nicht möglich sein einen UNC-Pfad zu erstellen wird ein leerer String zurück gegeben.

www.dotnet-snippets.de/...nc-pfad-ermitteln-SID1215.aspx - Preview

c# codesnippet unc directory

28 May 09

Wie kann ich ChangeConflicts in LINQ behandeln?

Wenn ich Daten in meinem LINQtoSQL DataContext ändere und diese Änderungen an die Datenbank senden möchte kommt es zu ChangeConflicts. Wie kann ich diese behandeln?

www.microsoft.com/...eConflictsInLINQBehandeln.mspx - Preview

linq howto help msdn codesnippet change conflict

01 Apr 09

Item ID in display and edit forms « Path to SharePoint

A frequent request: have the ID displayed when viewing an individual item, in display form (DispForm.aspx) and edit form (EditForm.aspx). This is for example useful when a team uses the default SharePoint ID as identifier in an Issue Tracking list.

Note: the ID cannot be displayed in NewForm.aspx, simply because the ID doesn’t exist yet when you add a new item.

pathtosharepoint.wordpress.com/...m-id-in-display-and-edit-forms - Preview

codesnippet sharepoint hack moss ID editing

25 Mar 09

SpicIE - Simple Plug-In Creator for Internet Explorer - Home

SpicIE is a framework which allows you easily to extend Internet Explorer 7/8 with your own plugins. SpicIE wraps/hides the IE COM extension interfaces and makes it easy to develop browser extensions in managed programming languages.

SpicIE is designed for simplicity. The initial creation of an Internet Explorer plugin with SpicIE takes only minutes until you have a runnable, debuggable code base which you can extend with your own functionality. There are lot of scenarios where browser plugins could be useful. SpicIE lets you develop your own browser functionality comfortable with minimal technical efforts.

With SpicIE you can develop your own:

* IE browsing event handlers
* IE toolbar buttons
* IE menu entries
* IE context menu entries
* IE explorer bars
* IE toolbars.


SpicIE is designed for managed plugin development. You can develop SpicIE plugins in any managed development language. You will have Visual Studio 2008 project templates for C# and VB.NET plugins.

code.msdn.microsoft.com/SpicIE - Preview

ie plugin software development microsoft msdn codesnippet

18 Mar 09

HowTo: Senden von Emails testen ohne Mailserver | Code-Inside Blog

mails mit .NET zu versenden ist recht einfach, wenn es allerdings darum geht, den generierten Emailtext zu testen, dann wird es manchmal etwas schwierig.
Vor allem wenn das Entwicklungssystem keinen Zugriff auf den richtigen Email-Server hat, geht es meist nur auf "gut Glück".
Es gibt allerdings einen einfachen Web.Config Eintrag der es erheblich vereinfacht - die PickupDirectoryLocation.

code-inside.de/...-emails-testen-ohne-mailserver - Preview

.net programming testing email sharepoint moss howto codesnippet

10 Feb 09

CodeProject: Blending HTML into Silverlight pages seamlessly. Free source code and programming help

The scenario that this article solves is the following: I am developing a simple image viewer page with a menu on the top-left. The menu is developed using Silverlight. By clicking the menu button, users can view a resizable image on the main page. In addition to showing an image, I also want the main page to be able to show an HTML content. Moreover, I want to use a Silverlight control to show the image or the HTML content.

There are two issues to be solved:

1. There is no existing HTML Silverlight control that can render an HTML page.
2. How to route the OnClick event from the Menu control to the Image control.

In the following sections, I will show you an idea of solving the above problems.

I assume readers are familiar with ASP.NET/C#, Silverlight, Visual Studio, JavaScript, and DHTML.

www.codeproject.com/...silverlighthtmlblend.aspx - Preview

silverlight codeproject blend codesnippet embedding html

06 Feb 09

The wrong way to iterate through SharePoint SPList Items

There are multiple ways to iterate through the items of a SharePoint list by using the SharePoint Object Model. One approach - which I’ve seen before in a real life SharePoint Application - may work fine on the developers machine or on very tiny lists. But it is going to ruin your performance once executed on a list that exceeds a couple of hundred items.

blog.dynatrace.com/...hrough-sharepoint-splist-items - Preview

sharepoint moss codesnippet iteration c# performance caching

Writing to the SharePoint Unified Logging Service – Windows Live

Writing to the SharePoint Unified Logging Service

SharePoint uses a logging service that makes entries in the log files located at Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS. Out-of-the-box, SharePoint logs almost everything to these files, and I have seen them get quite large. Therefore, you should "throttle" the log writing, which can be done in the "Diagnostic Logging" section of the Central Administration site.

Once you discover the log files, you'll want to be able to write to them from your own features. This is a pretty easy thing to do, because the SharePoint SDK has a complete sample with code you can reuse. I use this code regularly in my features, so I have packaged it into a class that you can download here. Simply add the class to your project and then you can write to the logs using something like the following code.

TraceProvider.RegisterTraceProvider();
TraceProvider.WriteTrace(TraceProvider.TagFromString("XXXX (must be 4 letter tag)"), TraceProvider.StringToSeverity("Exception or Information"), Guid.NewGuid(), "Method Name", "Assembly Name", "Project Name", "Message");
TraceProvider.UnregisterTraceProvider();

Once you start writing to the log files, you'll discover that there is no easy way to view them. SharePoint does not have a log viewer built into the Central Administration web site. I've written an additional feature for viewing logs that you can download from my CodePlex project.

scothillier.spaces.live.com/...cns!8F5DEA8AEA9E6FBB!236.entry - Preview

blogarticle sharepoint moss logging codesnippet c#

16 Jan 09

Display site members from AD Groups « Bits of Sharepoint

I recently have to do this for a client. The web part is suppose to display a list of all users from the Sharepoint Security groups for every site. The out of the box webpart(Site Users) will display only the name of the AD group and not the members within it.

To get started, it is easier if you installed the Webpart templates for VS.NET

Created a solution using webpart template and you are ready to go.

sharepointrookie.wordpress.com/...ay-site-members-from-ad-groups - Preview

webpart codesnippet moss blogarticle sharepoint activedirectory

09 Jan 09

Moving documents across sites with metadata using SPS object Model : How to import a listitem to a list using SPImport API

The Microsoft.SharePoint.Deployment object model is designed to work with data ranging from an entire Web site to a single item in a list or library. You can select the level of metadata to include with migrated content, as well as choose whether to do a full migration or provide only an incremental update.

blogs.msdn.com/...a-list-using-spimport-api.aspx - Preview

codesnippet sharepoint import export moss

18 Dec 08

C# - Threadsichere GUI Änderungen

Wenn man aus einem Background Thread mit der UI einer Windows Forms anwendung kommunizieren (Werte ändern) möchte, muss man dies mittels Invoke machen, nachfolgendes Snippet zeigt wie man sich schnell eine einfache Methode schreiben kann die selbst entscheidet ob ein Invoke von Nöten ist oder nicht.

www.dotnet-snippets.de/...e-gui-aenderungen-SID1043.aspx - Preview

.net codesnippet threading programming c# invoke delegate

Silverlight-City | Silverlight Objekte aus Xaml (XML) mit XamlReader dynamisch erzeugen

Der Beitrag beschreibt, wie mit Hilfe von XamlReader.Load Silverlight-Objekte dynamisch aus XML (Xaml) erstellt werden können.

Es gibt zahlreiche Gründe, Silverlight-Objekte dynamisch zu erstellen. Unter anderem gewinnst Du viel Flexibilität für Deine Anwendung.

blog.silverlight-city.de/...Reader-dynamisch-erzeugen.aspx - Preview

silverlight xaml codesnippet blogarticle dynamic

17 Oct 08

Moldenco: SPSecurity.RunWithElevatedPrivileges to update SPRoleAssignment of an SPListItem

When you write custom code in Sharepoint webparts, your code will run with your credentials.
Not everybody has Full Control, so when a user has only read rights, the code will throw an access denied error when the code needs access to objects that are not in the scope of the user credentials.... (example: add the username in the ReadBy properties of an item).

moldenco.blogspot.com/...withelevatedprivileges-to.html - Preview

sharepoint blogarticle seurity impersonation c# codesnippet

03 Oct 08

Snippet Designer - Home

* A Snippet editor integreated inside of the IDE.
o Access it by opening any .snippet file or going to File -> New -> File -> Code Snippet File
o It uses the native Visual Studio code editor so that you can write the snippets in the same enviorment you write your code.
o It lets you easily mark replacements by a convenient righ click menu.
o It displays properties of the snippet inside the Visual Studio properties window.

www.codeplex.com/SnippetDesigner - Preview

visualstudio snippet codesnippet manager addin opensource codeplex

26 Sep 08

Working with XML Data Using the XPathNavigator Class in InfoPath 2007 Form Templates

Learn how to use the XPathNavigator and XPathNodeIterator classes to access and work with data in business logic written with managed code in Microsoft Office InfoPath 2007 form templates.

msdn.microsoft.com/...bb509311(printer).aspx - Preview

infopath xml xpath codesnippet msdn

1 - 20 of 65 Next › Last »
Showing 20 items per page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo