Thursday, December 25, 2008

Business Intelligence and Sharepoint

This Videos are a start to Business Intelligence and Sharepoint Beginners, 
When i start to use Sharepoint "2006" this was one of the features i see and say "Ok this is the future, now have to grab..."

Now is your turn to see the power of Sharepoint, Big Databases and use this Data in a Client Way... 
Data without treatment is ineffective, Companys need response in a fast and efective way. There Business Intelligence enter, know what company does and know how to use and this videos can help you...


Friday, December 05, 2008

Just pass Microsoft Sharepoint Exam 70-541

Hi, Christmas Comes Early :)

Just pass exam "Microsoft Windows Sharepoint Services 3.0 - Aplication Development"


Saturday, November 29, 2008

ChartPart for SharePoint


With the launch of Microsoft Chart Controls for Microsoft .NET Chart Framework 3.5  was only a question of time Sharepoint fans explorer and develomp a Webpart to create Chart with Sharepoint List, but

"wictor Wilén" have explore and make a excelent work making chartpar Webpart, 

You can helping givin ideas, bug fixing or making translation.
I already make the portuguese translation... And you?

Sunday, November 16, 2008

How to change Sharepoint Embedded Database microsoft##ssee


Some time ago have this litle issue, change database on a sharepoint embedded Database, so i create this litle steps to make the move without using sql server "SQL Server Management".
This steps required a litle of knowledge of SQL commands.

Microsoft SQL Server Native Client X86 X64
Microsoft SQL Server 2005 Command Line Query Utility X86 X64

Adminstration Site Sharepoint 3.0

Central Administration> Application Management > Content Database
Remove Content Database.

Command lines
net pause mssql$sharepoint
net continue mssql$sharepoint

C:\>sqlcmd -S \\.\pipe\mssql$microsoft##ssee\sql\query -E
1> exec sp_detach_db 'WSS_Content';
2> go

Now copy you database from c:\windows\sysmsi\sse\mssql2005\mssql\data to your new directory
ex: D:\DB....

Back to command lines
1> exec sp_attach_db @dbname=N'WSS_Content', @filename1=N'[Path]WSS_Content.mdf', @filename2=[Path]WSS_Content_log.LDF';
2> go
1> quit
C:\>cd "Program Files"
C:\Program Files>cd "Common Files"
C:\Program Files\Common Files>cd "Microsoft Shared"
C:\Program Files\Common Files\Microsoft Shared>cd "web server extensions"
C:\Program Files\Common Files\Microsoft Shared\web server extensions>cd 12
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12>cd bin
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>stsadm -o addcontentdb -url http//[URL] -databasename WSS_content
Operação concluída com êxito.

Saturday, October 11, 2008

Access Mapping Sharepoint URL

Today article is configurate Mapping access, this configuration is very usefull to manage your public url Protocol (Intranet, Internet, custom or Extranet) mappings.
Every Sharepoint Consultant when create a new Site have configure Mapping access, almost all the installation i make want intranet and internet access.
This is a normal sharepoint administration have to deal and with the following steps made this so simple.

To access to mapping collection on sharepoint, go to your Sharepoint administration 3.0 site and select the following path:
Central Administration > Opertations > Alternate Access Mappings > Edit Public Zone URLs

will show all you Sharepoint Sites, and can start making the correct Mappings access.

Hope this help.

Saturday, September 27, 2008

Link button to Delete Current Sharepoint Webpart

Well on my search for new stuff i found all the Sharepoint Web Part javascripts events, i say to my self, "GREAT", now can explorer that litle secrect Sharepoint Webpart have, so i make this litle script to delete current Webpart.

I found this Javascript method "MSOLayout_AddChange(WebPart,Property,NewValue)" to update propertys, greate now just use....

Delete Web Part:
Add Content Editor Web Part and select "html editor"

< script type="Text/ JavaScript" >
function RemoveWP()
var WPQId;
var WPObject;
var titleid;
var WPQPos;;
if (WPQPos>0)
WPQId='WebPart' + titleid.substring(WPQPos, titleid.length);
< / script >
< href="#" onclick="javascript:RemoveWP()">Delete Webpart< / a >

Thursday, September 18, 2008

Sharepoint "to many Things" what to use?


Today will try to example a way to pick SharePoint, This tool is very powerfull, but is very complex to.

The concept one person can do everything, dont works here.

People when start working need to create a team and separate functions.

Thinks sharepoint like a Triangle,

  1. If you use the default customization that sharepoint have, they are good, to simple company who only want list library, Document Library, Version, if you need new column just add, they are just great, there so many things inside normaly people dont know they exist, site columns...
  2. Sharepoint Designer 2007, If you need to change layout, new masterpage, create connections to Databases (SQL,ORACLE,Web Services), use controls without many develomp, you can use with drags and drop, some of the feateures can be complex, and sharepoint designer have a Workflow designer i consider great "simple and direct". You create simple and direct pages (Html, aspx) that use web parts, sharepoint Designer have direct connection to Sharepoint Web Parts. Connection to list and other webpart can be easy and superb, you can create webparts "Data View" of data and make filter between list and data in a easy way, and Webpart connections (Consumer, Provider). Hummm you read this and think "great, this is what i want".
  3. Well 3 part of my Triangle is Visual Studio, is the last thing we should pick :P, this "weapon" in good hands can change everything, like complex Workflows, Event handler, site features.... can go all night.... But, yes in life we will meet big buts, the cost of develomp and the time you spend. If you are a senior developer and never saw this GREAT TOOL, will need to use all your skills in ASP.NET, Configuration, network, need to study and read a lot os page and read SDK WSS, and books, can be a high cost in final project. Need a Team not solo.

Hope this litle article help.

Saturday, September 13, 2008

SharePoint List Templates

When we are creating List using elemnts.xml and feature.xml, need to know what Template ID code to use.
here is a list can help you.

Template ID Description
100 Generic list
101 Document library
102 Survey
103 Links list
104 Announcements list
105 Contacts list
106 Events list
107 Tasks list
108 Discussion board
109 Picture library
110 Data Sources list
111 Site Template Gallery
113 Web Part Gallery
114 List Template Gallery
115 XML Form Library (InfoPath)
120 Custom grid for list
200 Meeting Series list
201 Meeting Agenda list
204 Meeting Decisions list
207 Meeting Objectives list
210 Meeting text box
211 “Things to Bring” Meeting list
212 Meeting Workspace Pages list
300 Portal Sites list
1100 Issue Tracking list
2002 Personal document library
2003 Private document library

Saturday, September 06, 2008

Sharepoint upload Web part V.

My WebPart

Hello again, well almost every day have new idea to develomp my webpart.

Today is using the URL querystring to make filter on documents views.
Imagine, you want to filter your document list with microsoft word (doc), how do i do???, url can be a answer.

Now give the habitilty to determine what documents you want to filter, to do that you will have to add you custom document, like:
Name: Microsoft Word 2003
Type: doc
Name: Acrobat

Just simples like that.

Wednesday, September 03, 2008

Sharepoint upload Web part V.

My WebPart


1º Add new Custom Columns.
2º Add Metadata Content to Document upload (single text), next feature is associate controls to columns(TextControl, datetime, etc..).
3º All options from 1.0.0.*.

Now have the hability to add Custom Metadata Columns.

Wednesday, August 20, 2008

Business Objects XI R2 Search Web Part Sharepoint Part II

Like i promisse, have the webpart for sharepoint for Business Objects search, but i use the Business Objects web services consumer common classes.

You will need to convert the Business object Web Services in Class
To do That you will need to follow this steps:
Path "C:\Programas\Microsoft Visual Studio 8\SDK\v2.0\Bin"
wsdl.exe /l:CS /n:BusinessObjects.DSWS.Session /out:Session.cs http://[CMS_SERVER]:8080/dswsbobje/services/session?WSDL
wsdl.exe /l:CS /n:BusinessObjects.DSWS.BICatalog /out:BICatalog.cs http://[CMS_SERVER]:8080/dswsbobje/services/bicatalog?WSDL
wsdl.exe /l:CS /n:BusinessObjects.DSWS.ReportEngine /out:ReportEngine.cs http://[CMS_SERVER]:8080/dswsbobje/services/reportengine?WSDL

using BusinessObjects.DSWS.Session;
using BusinessObjects.DSWS.BICatalog;
using BusinessObjects.DSWS.ReportEngine;

or download .NET Consumer Library

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Xml.Serialization;
using Microsoft.SharePoint.WebPartPages;
using System.Net;
using BusinessObjects.DSWS.Session;
using BusinessObjects.DSWS.BICatalog;
using BusinessObjects.DSWS.ReportEngine;

namespace SearchBOXI
[ToolboxData("<{0}:SearchBO runat=\"server\" />")]
public class SearchBOXI : Microsoft.SharePoint.WebPartPages.WebPart
#region Variables
string html;
private string _BOServer = "http://localhost:8080";
private string _Password;
private string _Login;
private string _Domain;
private string _URLSession = "http://localhost:8080/dswsbobje/services/session";
private Button BtSearch;
private Label LbSearch;
private TextBox TxtSearch;
protected Auth _Auth;
private String link;
public enum Auth
secEnterprise, secLDAP, secWinAD
public SearchBOXI()
this.ExportMode = WebPartExportMode.All;
#region Public Personalizable Properties
[WebDescription("Business Objects Server Name")]
[Category("Business Objects Option")]
[WebDisplayName("Business Objects Server Name")]
public string BOServer
return _BOServer;
set { _BOServer = value; }
[WebDescription("URL Web Service Session")]
[Category("Business Objects Option")]
[WebDisplayName("URL Web Service Session")]
public string URLSession
get { return _URLSession; }
set { _URLSession = value; }
[Category("Business Objects Authentication")]
public string Login
get { return _Login; }
set { _Login = value; }
[Category("Business Objects Authentication")]
public string Password
get { return _Password; }
set { _Password = value; }
[Category("Business Objects Authentication")]
public string Domain
get { return _Domain; }
set { _Domain = value; }
[Category("Business Objects Authentication")]
public Auth Author
get { return _Auth; }
set { _Auth = value; }
#region Create Child Control
protected override void CreateChildControls()
this.BtSearch = new Button();
this.BtSearch.ID = "_BtSearch";
this.BtSearch.Text = "Search";
this.BtSearch.Click += new EventHandler(BtSearch_Click);
this.LbSearch = new Label();
this.LbSearch.ID = "_LbSearch";
this.LbSearch.Text = "Document Search BO";
this.TxtSearch = new TextBox();
this.TxtSearch.Width = Unit.Pixel(250);
this.TxtSearch.ID = "_TxtSearch";
void BtSearch_Click(object sender, EventArgs e)
private void Search()
BusinessObjects.DSWS.Connection boConnection = null;
string boConString = URLSession;
boConnection = new BusinessObjects.DSWS.Connection(boConString);
boConnection.Credentials = CredentialCache.DefaultCredentials;
//boConnection.Credentials = new NetworkCredential(Login, Password, Domain);
boConnection.IsKerberosAuthenticationEnabled = true;
EnterpriseCredential boCredential = new EnterpriseCredential();

if (Domain.Trim().Equals(""))
{ boCredential.Domain = string.Empty; }
else { boCredential.Domain = Domain; }

if (Login.Trim().Equals(""))
{ boCredential.Login = string.Empty; }
else { boCredential.Login = Login; }

if (Password.Trim().Equals(""))
{ boCredential.Password = String.Empty; }
{ boCredential.Password = Password; }

if (Auth.secEnterprise == Author)
{ boCredential.AuthType = "secEnterprise"; }
else if (Auth.secLDAP == Author)
{ boCredential.AuthType = "secLDAP"; }
else if (Auth.secWinAD == Author)
{ boCredential.AuthType = "secWinAD"; }

Credential val = new Credential();
Session boSession = new Session(boConnection);
SessionInfo boSI = boSession.Login(boCredential);
string Token = boSI.DefaultToken;
String[] strBOCatURL = boSession.GetAssociatedServicesURL("BICatalog");
BICatalog boCatalog = BICatalog.GetInstance(boSession, strBOCatURL[0]);
ReportEngine oDSWRE = new ReportEngine(boCatalog.Connection, boSession.ConnectionState);
BusinessObjects.DSWS.BICatalog.SortType[] mySort = new BusinessObjects.DSWS.BICatalog.SortType[1];
mySort[0] = BusinessObjects.DSWS.BICatalog.SortType.NAMEASC;
SimpleSearch mySearch = new SimpleSearch();
mySearch.InAuthor = Login;
mySearch.InName = this.TxtSearch.Text.Trim();
mySearch.ObjectType = "documents";
link = "";
BICatalogObject[] searchResults = boCatalog.Search(mySearch, mySort, null, null, InstanceRetrievalType.ALL);
foreach (BICatalogObject myBOCatObject in searchResults)
link = BOServer + "/businessobjects/enterprise115/desktoplaunch/InfoView/CrystalEnterprise_Webi/" + myBOCatObject.UID + "&logonToken=" + Token;
html = link;


catch (Exception ex)
html = "No values...
" + ex.Message;
protected override void Render(HtmlTextWriter writer)
catch (Exception ex)
writer.Write(ex.Message + " " + ex.StackTrace);

Friday, August 15, 2008

Business Objects XI R2 Search Web Part Sharepoint

Hi, i am preparing a Business Object search Web part using Sharepoint,
Will try use a litle of Business Object SDK and Sharepoint SDK.

In 1 or 2 days will make a Beta launch on codeplex.

Stay tune...

Wednesday, August 13, 2008

How to get user Token Business Object XI R2


Working with Business Object Framewok can be tricky, but when you are working and need to make link to BO, without pass the authentication page on BO, this litle example can help get the token to create directs link to Web Inteligence.

using CrystalDecisions.Enterprise;

String Token;
using (CrystalDecisions.Enterprise.SessionMgr sessionMgr = new CrystalDecisions.Enterprise.SessionMgr())
EnterpriseSession enterpriseSession = sessionMgr.Logon("Login", "Password", "BOServer", "secEnterprise");

Token = enterpriseSession.LogonTokenMgr.CreateLogonTokenEx("", 60, 100);


Tuesday, August 12, 2008

Integrating Microsoft CRM 4.0 with Windows SharePoint Services

If you are a Developer, configuration and implementation etc etc of Sharepoint and Microsoft CRM, this is a book that helps you create a real integration, dashboards, data, etc etc.
Great Book.

Integrating Microsoft CRM 4.0 with Windows SharePoint Services

Here a excelent article Link about Sharepoint and CRM
"Developing a SharePoint custom field type for displaying CRM 4.0 data"

Display a SharePoint document library in a Microsoft Dynamics CRM 3.0 form

SharePoint Document Libraries in Microsoft CRM

Creating a Custom Web Service in SharePoint for Uploading Document
"upload the document to SharePoint document library whenever a file has been attached to our entities in Microsoft Dynamics CRM"

Use case: Integrating Microsoft Office SharePoint with Microsoft Dynamics CRM

Wednesday, August 06, 2008

Business Objects Dashboard Sharepoint MOSS2007 Solution Architecture

Business object is a very powerfull Tool in BI World and Web Inteligence Reports are so great to users because can make their own reports, but to intregrate Dashboard with Sharepoint the Permorfance can be slow when opens a report?

This Architecture try to have a better performance on reports.

Have Business Objects in one side and Microsoft Sharepoint 2007 in the other.

Need to create Dashboards on Sharepoint from Business Object reports (Web Inteligence ) but if i use Business Object Web Part, is a excellent BI Tools but need to aware of a lot of possible issues like Authentication, performance(Loading Reports with huge amount of data can take some time) ...

If you need real time Data, you will need to use Busines Object Web Part or you can make code to call the reports in your SharePoint environment.
Here some articles:
Business Objects XI R2 List Treeview Reports With SharePoint
Business Objects XI R2 Search Web Part Sharepoint Part II
How to get user Token Business Object XI R2
"Single Sign-On and Active Directory-SSO with Integration Option for Microsoft SharePoint XI 3.1"

If you need to show temporary reports like "Performance of the day" or other time define Reports and Dashboard you can create or solution like this:

So need to improve performance page loading on Sharepoint Dashboard, html page can be a solution.
I reach this Solution (I dont say it the best, If you have one better, you can help build...).
Schedule every day the web Inteligence report to a Html page and Show in Sharepoint by Dashboard.

1º Step, Business Objects Reports
Schedule BO to send every day a Email with report with excel file,
"Dont now how to send Html file..." :(
You can send to a phisical folder, (Local Folder Server or FTP)

2º Step, Incoming mail will redirect to Document Library (If you chose Email)
There Document Library will start Event Handler to convert XlS file to Html

3º Step, Create 2 Webpart.
First will list Report Files.
Secont will show Report in HTML.
Create a connection betwen Librarys.
Loading Reports will be fast.

I jump many and many adminstrations steps, "exchange folder, acounts, etc" but just want to show a global idea.
Ok now is done,
Permission problems?
Can use the sharepoint Permission to control Access.

I also recomend install "Business Object XI Release 2 SharePoint 2007 Integration Kit" WebParts are very usefull, but have some limitation like only work with 32 Bit...

Hope this article help you.

SharePoint STSADM Commands


How many of you have problem With Stsadm, ALL.
Every time i work with Sharepoint have to learn a new command, STSADM is real techincal stuff, backup, restore, attach database, stop search, crawl, you say and its there...

Microsoft have launch a technical manual that explains the stsadm command
Office SharePoint Server IT Pro content CHM

Here you have a good site that explains the using of STSADM command with excelent

Sharepoint Menu Document Library Links

You may ask to your self, How do i get the Links to delete a list item?
Microsoft have a litle tutorial Using the URL Protocol that help you building you url and add the parameters to create a new List, or delete a ListItem like this example

Delete Listitem:

New List:

This values are direct, you problaby ask "how do i get dinamyc, directly from the Table", and i say yes is possible..., how?
Go to Core.js, this file is located:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033

This file in javascript is very important because already have a lot of method that return list name, id...

function Custom_AddDocLibMenuItems(m, ctx) ="Function to add Custom Menu"
ctx.HttpRoot = "Url Root";
currentItemID ="ItemID";
ctx.listName ="ListID";
ctx.imagesPath="Path for images" ctx.imagesPath + 'Folder.GIF'
GetAttributeFromItemTable(itemTable, 'Url', 'ServerUrl')=Get File Path
CAMOpt(m,"Description",ActionOnClick,ImagePath)=Add Function to menu
CAMSep(m) ="Create a Separator on Menu"
return(true)= Default menu is off
return(false)= Default menu is on

This file help me creating my sharepoint upload Document webpart.

Tuesday, August 05, 2008

Hide Sharepoint List Sharepoint Designer, SDK

Updated article with SharePoint 2010 Here

Today i want to show how to hide a Sharepoint List from users and administrators.
There are 2 way to hide Sharepoint List via Browser
By code or by Sharepoint Designer.

On Sharepoint Designer,
Open Web site, select you List and select check box "Hide".

On Sharepoint SDK
SPWeb Web = SPContext.Current.Web;
SPList List = Web.Lists["Your_List_Name"];
List.Hidden = true;

Hope you like.

Add Account Company logo on Microsoft CRM 3.0

Normaly Company want to know the logo of the Account, want to feel close to final client, by default Microsoft CRM dont give you a field to add a photo of your Account or contact.
So i make this litle code, using external tool like Access, page of, and configuring a iframe.
This trick save me a lot of times.

Create a new Database Where i collect information on Access.

Create a new Table add the following columns
Id=Guid of Account (Text)
Foto=Binary of the Photo(The image will be save on you Access file)

2º Step
On Microsoft CRM Configuration, select Account, and Form.
There create a Iframe please select the option to object code to the url, like "ID={Guid}"
(you Put)Iframe=/photo/photo.aspx
When navigatin the result will be something like this
This is very usefull, explore and you will like the final result.
After This, publish you configurations.

3º Step
Ok now we can start with code

Let start with Page life Cycle

BtDel.Attributes.Add("onclick", "javascript:if(confirm('Delete Photo?')== false) return false;");
MemoryStream stream = new MemoryStream();
OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;data source=" + Server.MapPath("Foto.mdb"));
OleDbCommand command = new OleDbCommand("select Foto from Foto where ID="+ Request.Params["id"].ToString(), connection);
byte[] image = (byte[])command.ExecuteScalar();
if (image != null)
Upload.Visible = false;
BtAdd.Visible = false;
BtDel.Visible = true;
stream.Write(image, 0, image.Length);
DynamicImage1.ImageBytes = stream.ToArray();
DynamicImage1.ImageFile = "http://[server]/_imgs/grid_Temp.gif";

catch( NullReferenceException ex )
DynamicImage1.ImageFile = "http://[Server]/_imgs/grid_Temp.gif";
Upload.Visible = false;
BtAdd.Visible = false;
BtDel.Visible = false;
Console.WriteLine( "Caught error: {0}.", e);


Now Event Handler to add Photo

int len = Upload.PostedFile.ContentLength;
byte[] pic = new byte[len];
Upload.PostedFile.InputStream.Read(pic, 0, len);
// Insert the image and comment into the database
OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;data source=" + Server.MapPath("Foto.mdb"));
OleDbCommand cmd = new OleDbCommand("insert into Foto "
+ "(ID, foto) values (" + Request.Params["id"].ToString() +",@pic)", connection);
cmd.Parameters.Add("@Pic", System.Data.OleDb.OleDbType.Binary,pic.Length).Value = pic;
Page.Response.Redirect(Page.Request.Url.ToString(), true);


Now Event Handler to Delete Photo

OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;data source=" + Server.MapPath("Foto.mdb"));
OleDbCommand cmd = new OleDbCommand("Delete from foto where ID=" + Request.Params["id"].ToString(), connection);
Page.Response.Redirect(Page.Request.Url.ToString(), true);

Ok The essencial is here,
Hope you like this article, works for me.

Problems accessing Sharepoint or Microsoft CRM, "Host" file

You problably have this problem, "or not", but is normal having problem accessing Sharepoint and Microsoft CRM, you have all configurations right on server and allways works fine there, some computers can access sharepoint or Microsoft CRM, other dont, but you say to youself "There all the same, whats wrong", well sometimes litle things can be like a mosquito.

This problem can be a simple thing like Changing and adding line on "Host" File.
This file is located on your PC "C:\WINDOWS\system32\drivers\etc" if you have Windows XP.

Have to open "Host" file and add a mapped address adding IP and server name
example: crm:5555

Try again and you problaby will get access.
Remember this could be only one of the problem, "proxys", network problem, DHCP, there other issues, but now only focus this.

Hope this article help.

Monday, August 04, 2008

Control your Sharepoint Permissions in SDK

One big problem in sharepoint is permission, allways permission, today have contribute, tomorow have read.
This is not the best policy, allways changing...., have to make rules! Talk to you client, sit 2,3,4,6 hours, 2 day... trying to understand the business, what can they see, get and put Data, Forms to be made, who are the final users, Designer... "My Kingdom" for a good designer, SharePoint could do nothing but if you have a good designer people will have apetite to prove sharepoint :).
Define all, only there you can start managing "if is a customer pre-requisite" permission.

Hope you like, and "CODE WILL THE LAST THING YOU TOUCH, ALLWAYS", not because is hard "not...", but can compromise times of develomp, and business, use other tools like Sharepoint Designer and Third tool exist in "Codeplex" and other Sites to help Configuring your site.

Here you have a litle code to add, remove group and change permissions:
Managing Permission in a ListItem
//add user
SPListItem i = fileI.Item;
i.Web.AllowUnsafeUpdates = true;
i.Web.AllowUnsafeUpdates = true;
SPRoleDefinition rd = i.Web.RoleDefinitions.GetByType(SPRoleType.Reader);
SPRoleAssignment ra = new SPRoleAssignment(SPUser user);

//Change Permission Groups To read
SPListItem itemH = file.Item;
SPRoleDefinition rd = itemH.Web.RoleDefinitions.GetByType(SPRoleType.Reader);
SPRoleAssignment ra;
foreach (SPGroup Group in cweb.Groups)
ra = new SPRoleAssignment(Group);

//Remove a Group
SPGroup group = cweb.Groups["Group Name"];

Update ListItem Sharepoint programmatically


How many time you try update a listitem and give a error like "Access Denied" or "Error Page", when you are working with event handlers or a simple postback, well the trick is using "AllowUnsafeUpdates"

SPSite site = SPControl.GetContextSite(Context);
SPWeb web = site.OpenWeb();

SPSite csite = new SPSite(site.ID);
SPWeb cweb = csite.OpenWeb(web.ID);
csite.AllowUnsafeUpdates = true;
cweb.AllowUnsafeUpdates = true;
SPFile file = cweb.GetFile(this.fileURL.Value);
SPListItem itemH = file.Item;
itemH.Web.AllowUnsafeUpdates = true;
itemH.Web.AllowUnsafeUpdates = true;
itemH["Title"] = "My Name";


Sunday, August 03, 2008

Auto Populate Follow Up "Phone Call" CRM


This tip is for free, :)

How many times you think, "finish phone call and need to make a follow up and want to populate with data", well computer dont think for us, but we can create some rules.
This rules can be done with litle code, just use this litle javascript "On_load" event "Phone call Form" to create a fast follow up.
This litle code, help me a lot with Lazy customers :)
Hope you like this article.

I use Portuguese CRM, please change some Var to use with English
//Follow Up
document.getElementById("ContextSelect").onblur = ChangeSeguimento;

function OpenFollowUp()

function ChangeSeguimento()
if(document.getElementById("ContextSelect").DataValue == "followup")
//English use "Activity Type"
//Portuguese use "Tipo de Actividade"
if(document.getElementById("activitytype").innerText == "Activity Type")
document.getElementById("activitytype").id = "activitytype1";
document.getElementById("activitytype").onblur= PreencheType;


function PreencheType()
if(document.getElementById("activitytype").DataValue == "4210")
var lookupItem = new Array;
lookupItem = document.getElementById("from").DataValue;

var lookupItemTo = new Array;
lookupItemTo = document.getElementById("to").DataValue;

document.getElementById("from").id = "from1";
var lookItmGrp = new Array();
lookItmGrp[0] = new LookupControlItem(lookupItem[0].id , lookupItem[0].type,lookupItem[0].name );
document.getElementById("from").DataValue = lookItmGrp;
document.getElementById("from1").id = "from";

document.getElementById("to").id = "to1";
var lookItmGrp1 = new Array();
lookItmGrp1[0] = new LookupControlItem(lookupItemTo[0].id , lookupItemTo[0].type,lookupItemTo[0].name );
document.getElementById("to").DataValue = lookItmGrp1;
document.getElementById("to1").id = "to";
//document.getElementById("activitytype1").id = "activitytype";

Friday, August 01, 2008

Calculator Sharepoint Web Part

Hi again,

Here you have a nice calculator inside Sharepoint, cool stuff :)
Import File .dwp and drag to web part zone.

Hope you like and help...

Can download or
Download Calculator.dwp

Connect Sharepoint User Info Web Services


This arthicle will try to help you to make a simple connection via Web services and Sharepoint Designer to Users Info .

First you will need to create Datasource Library, go to the tab "Data Source Library" and select option "XML Web Services".

There you create a new connection.
First: you need to now what Web Service you need.
Physical the Web services are located here:
:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI

To the purpose whe want you can use the "/_vti_bin/lists.asmx"

Second: Select the operation "GetListItems"

Third: Now you have a list of Parameters
Need to fill Parameter "listname" with name "User Information List"

After that you have connect to Web Service.
Then you need to work with Data.
Select the create Web Service on Datasource Library, and select "SHOW DATA".
There you select the field you want to show and when select "Multiple View", and the data will be show in a Table.

You are also able to use user information calling the Listname UserInfo, This happen if  you multiple language like German, the "User Information List" will have different name for that and UserInfo will be generics.

<soapenv:Envelope xmlns:soapenv=''> \
  <soapenv:Body> \
   <GetListItems xmlns=''> \
      <listName>UserInfo</listName> \
    </GetListItems> \
 </soapenv:Body> \

Lists.GetListItems Method

Hope this litle arthicle help.

Friday, July 25, 2008

Just pass Microsoft Sharepoint Exam 70-630

Just pass Microsoft Sharepoint Exam 70-630 "Configuring Microsoft Office Sharepoint Server 2007"

First time i make a microsoft Exam :)

Was not easy, but now is done.

Tuesday, June 10, 2008

Sharepoint upload Web part

Some days ago, have a question?
Want control the upload events after upload my document.
Ok, i know we can control the redirect pages and the pages.
But i want to give to the customer a easy and fast way to send documents to the document library, and give him the oportunity to chose where want to go after upload, so i create 2 parameters.
1º The name of the Document Library
2º The page you want to redirect, after you upload file or if you want to cancel.

Just easy like that,
Hope this webpart will help you....

My Sharepoint Webpart.
Upload Webpart


New parameters
1º Enable/Disable Redirect Links on button On or Cancel
2º Active redirect link on button On or Cancel
3º Enable/Disable Overwrite option
4º Enable/Disable Multiple upload option
5º Enable/Disable Redirect Links on Multiple upload
6º Select Document Library to upload Document


New parameters
1º Enable Default web site (this option will get all Document Librarys from current web site)
2º URL Web Site (Will get all Document Library of that web site)

Now you will have the capability to upload Documents to every Web site and sub sites where the user have permissions.


New parameters
1º Validation Button OK (Upload? yes/no)
2º Validation Button Cancel (Close Window)


New Parameter
1. Current Document Library View to Upload Documents
2. Select View of Document Library is not complete.


New Parameter
1. Link to select Document Library.
2. Print Current Document Library View in new Page.


New Parameter
1º Progress Bar
2º Root Folder
3º Expand/Hide "Upload","Document Library View"


New Parameter
1º Create new Menu Options
2º Create Shortcut
3º Print Options (Print Page, Print Web Part)

Now you have the hability to input some reference like send direct e-mail or redirect html page, and associate the image to the content.


New Parameter
1º Change Document Library dinamyc (Enable/Disable) option.

New Parameter
1º Block File Extension example(.pdf.doc)

Sunday, May 11, 2008

Print current Page Sharepoint

You problably ask your self "where i can print the current page?", well arent direct button, so we have to create one simple button.
To create the button, add a Content Editor Web part, select the source editor and put the follow code:

function printWindow(){
bV = parseInt(navigator.appVersion)
if (bV >= 4) window.print()
<img src="/imagens/print_ico.jpg" alt="Print This Page">
<a href="javascript:printWindow()">Print This Page</a>

Friday, April 25, 2008

Code Tester Webpart C#

Hi, Sharepoint is like a candy, sweet, but this webpart make this more sweet, i was looking in codeplex and saw this webpart and i think "iisreset, forget me" 2 or 3 minutes waiting see some sharepoint page, Code Tester webpart, but this can be a break of security because you can call all .dll inside the server and delete your c:\ and other things like sharing and sending emails with server details, please just use in your develomp zone, and with responsable persons...

Friday, April 11, 2008

Access Denied Run With Elevated Privileges delegate

Access Denied Run With Elevated Privileges delegate.

You problably have this problem i ask to heaven "WHY?????", well the answer is bad code, yes i do have the read 12 times the sdk to follow the microsoft good source code.
I have this problem, and .AllowUnsafeUpdates = true; dont answer because the using method was bad, then i find this Post this give some ligths on my BAD code :P .

But first We have to read the best pratices by microsoft, after reading this well, hope dont have this problem anymore....

//simple steep
String str;

using(SPSite oSPsite = new SPSite("http://server"))
using(SPWeb oSPWeb = oSPSite.OpenWeb())
str = oSPWeb.Title;
str = oSPWeb.Url;

//This steep is the most complete but like microsoft say Response.Redirect WILL NOT execute the finally block
String str;
SPSite oSPSite = null;
SPWeb oSPWeb = null;

oSPSite = new SPSite("http://server");
oSPWeb = oSPSite.OpenWeb(..);

str = oSPWeb.Title;
if (oSPWeb != null)

if (oSPSite != null)

catch(Exception e)
if (oSPWeb != null)

if (oSPSite != null)

So after you learn this first litle steep i start to understan whats wrong with my code, and understand what Kjetil Gullen do.

Thanks Kjetil Gullen.

public void CreateDocArchive()
SPWeb _webInUserContext = SPContext.Current.Web;
SPSite _siteInUserContext = SPContext.Current.Site;
Guid _webGuid = _webInUserContext.ID;
Guid _siteGuid = _siteInUserContext.ID;
using (SPSite _site = new SPSite(_siteGuid))
_site.AllowUnsafeUpdates = true;
SPWeb _web = site.OpenWeb();
_web.AllowUnsafeUpdates = true;
Guid _id = web.Lists.Add(
"My DocLib",
"Description of my docLib",
web.ListTemplates["Document Library"]);

SPList _docLib = web.Lists[_id];
_docLib.EnableVersioning = true;
_docLib.AllowEveryoneViewItems = false;
_docLib.EnableSyndication = false;
_docLib.EnableAssignToEmail = false;

SPFolder _folder = _docLib.RootFolder.SubFolders.Add("My readonly folder");

SPListItem i = _folder.Item;
i.Web.AllowUnsafeUpdates = true;


i.Web.AllowUnsafeUpdates = true;

foreach (SPRoleAssignment spra in i.RoleAssignments)
SPRoleDefinition rd = _mappe.Item.Web.RoleDefinitions.GetByType(SPRoleType.Reader);
SPRoleAssignment ra = new SPRoleAssignment(_webInUserContext.CurrentUser);

Wednesday, April 09, 2008

Create a nice Webpart Stock Graph

To create this nice webpart just add a "Content editor" Web part page.

Select "Source Editor" and add the following code:

Or you can also use the Out of the Box Web Part (XML Viewer) to create you stock exchange Web Part.

You can download this and other useful Web Parts here:

Hope you like :)

Create a simple sharepoint Webpart to see Groups and respective users

private StringBuilder Html;
private PeopleEditor p;
public SPWeb oWebsite;

protected override void Render(HtmlTextWriter writer)
oWebsite = SPContext.Current.Site.RootWeb;
SPGroupCollection collGroups = oWebsite.SiteGroups;
foreach (SPGroup oGroup in collGroups)
writer.Write(""+SPEncode.HtmlEncode(oGroup.Name) + "
foreach (SPUser users in oGroup.Users)
writer.Write(SPEncode.HtmlEncode(users.Name) + "
catch (Exception ex)
writer.Write(ex.Message + " " + ex.StackTrace);

Friday, March 07, 2008

Big Sharepoint Database, SHRINK .LDF file

Do you have space problem and you see your databases and see .mdf file with 100 mb and you .ldf file WITH 9GB you think "what in the hell...", can SHRINK the file, to do that just use this querys....

Using Management SQL Server
  1. Right click WSS_Content Database and select Tasks then Backup
  2. Select backtup type "Transaction log", and select destination backup file and click Ok.
  3. After backing up the DB, right click WSS_Content database and choose Tasks then Shrink and Files
  4. Select the type log and shrink action verify your space disk....
Support Document
SharePoint 2007:
Database maintenance for Office SharePoint Server 2007
SharePoint 2010:
Database maintenance for SharePoint Server 2010


List Databases
SELECT name FROM master..sysdatabases ORDER BY name

--Chose Databases

Friday, February 15, 2008

Visual Basic Manual

Microsoft put a nice Manual of Visual Basic Language Specification 9.0.

If you are a beginner this can be a way to start with visual studio and old visual basic code, still my favorite but now i develomp everything with C#.

Good luck....

Wednesday, February 13, 2008

Integrating Siebel CRM with Microsoft SharePoint Server

I was looking on google for web services for sharepoint and found this, great, have friends working with siebel and this can help you workers of siebel, i now is hard working with Oracle sometimes...

Hope this manual will help you

Integrating Siebel CRM with Microsoft SharePoint Server

Sync File from Sharepoint 3.0 site Offline Online

Oh my good, my praids are answer, but the best of all everything work´s well.
THANK YOU "Chris Johnson".

How this Work.

Very easy
Donwload SyncToy v1.4
This litle software will make the sync.

But Before you have to create a network connection to you sharepoint site where are the folder you want to sync, there are 2 ways to do this.
Justo open explorer and create the new network unit.

Or create by msdos, like i show in other post you can create network folder with authentication to you sharepoint like this:
net use http://[site]/document /user:[Username] [Password]

After create the network folder verify if are there the documents.
After this you configure SyncToy.
The 1 folder(Left) where will be the offline Folder with Documents.
The 2 folder(right) will be to the network connection (Z:) where are Documents of sharepoint site.
Just simple like that, then after this you will only have to run or preview and it´s done...

Sharepoint web part Quick quote

Hello again, When you install Office 2003 webpart will come a new webpart that call quotes from company you already now like Microsoft (MSFT), google(GOOG) or ORACLE (ORCL), this is are the tags you have to put to retrive some info. If you are in stock this can help you...

Sunday, February 10, 2008

Virtual Earth and Sharepoint 3.0

This video show you how with few code can use Virtual Earth in sharepoint.

There is more complex examples in the examples use sharepoint Data integration, explore the site you will see.

If you want to explore more of Virtual Earth you can see this examples:

Video: Virtual Earth & SharePoint 2007


VBscript Reference

Hi, this weekend i was exploring my folder and i found a file very interesting...
People can use to develomp in VBscript, This is a litle manual of develomp Vbscript

Display Output:

    Wscript.Echo “Display this text”
    MsgBox(“Prompt”, vbOKCancel, “Title”)
    WshShell.Popup(“Message”, 5, “Title”, 1)
    5: number of seconds to display popup box
Error Handling:

    On Error Resume Next
    Option Explicit
    If Err.Number Then
    ‘ an error occurred
    End If
    (execute this statement each time you check the Err object)


  • COMPUTER VARIABLE (local computer)
    strComputer = “.”
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process")
    Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service")


  • COMPUTER VARIABLE (local computer)
    strComputer = “localhost”
    Set objOU = GetObject("LDAP://ou=finance,dc=fabrikam,dc=com")
    Set objUser = GetObject("LDAP://cn=ken myer, ou=Finance, dc=fabrikam,
    Set colAccounts = GetObject("WinNT://" & strComputer)


    Const ForReading = 1

    Set objFSO = CreateObject _
    Set objTextFile = objFSO.OpenTextFile _
    ("c:\scripts\servers.txt", ForReading)
    Const ForWriting = 2

    Set objFSO = CreateObject _
    Set objTextFile = objFSO.OpenTextFile _
    ("c:\scripts\servers.txt", ForWriting)

Search Active Directory:

On Error Resume Next


Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_ONELEVEL

objCommand.CommandText = _
"SELECT Name FROM 'LDAP://OU=finance,dc=fabrikam,dc=com'“
Set objRecordSet = objCommand.Execute

Microsoft Office:

  • Excel
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    Set objWorkbook = objExcel.Workbooks.Add
  • Word
    Set objWord = CreateObject("Word.Application")
    objWord.Visible = True
    Set objDoc = objWord.Documents.Open("c:\scripts\test.doc")
  • Access
    Set objAccess = CreateObject("Access.Application")
    objAccess.OpenCurrentDatabase "C:\Scripts\Test.mdb"
  • Outlook
    Set objOutlook = CreateObject("Outlook.Application")
    Set objNamespace = objOutlook.GetNamespace("MAPI")

VbScript Syntax

    If Then

    If x = 4 Then

    ElseIf x = 5 Then

    End If

    Select Case

    Select Case x
    Case 1
    Case 2
    Case Else

    End Select

    arrItems = Array("a","b","c")

    Dim arr(2)
    arr(0) = 20
    arr(1) = 30

    ReDim Preserve arr(3)
    arr(2) = 40

    For Loops

    For Each x in arr

    For i = 1 to 10
  • While Loops

    While x < 5 …
  • Do Loops

    Do Until x > 5

    Do While x <> 5

    Loop While x <5

  • Function

    Function TestFunc

    TestFunc = 10
    End Function
  • Subroutine

    Sub TestSub

    End Sub

Run Scripts:

    C:\> cscript test.vbs
    C:\> cscript //H:cscript
    C:\> wscript test.vbs
    C:\> cscript //H:wscript

    Saturday, February 02, 2008

    Convert Quick Campaign Response

    Hello, Microsoft CRM 3.0 can be a useful tool when you create campaigns and everything you need, but quick campaigns, cool one activity, but when you make a campagin response in a letter you say huuuummm.... what "Template letter" i have to response?...

    Well to answer that question i just create this simples steps

    1 Step:
    Go to your "isv.config.xml"
    <entity name="letter">
    <button title="Quick Campaign Response" tooltip="Quick Campaign Response" icon="/_imgs/ico_18_4401.gif">

    2 Step:
    Go to customize Letter Entity Form and select OnLoad():


    function FnOpenWindow()
    {'http://[server]/ma/campaignresponse/edit.aspx?_CreateFromType=4207&_CreateFromId='+gup( 'id' ),'Campanha','width=800,height=1024,top=30,left=30,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1');

    function gup( name ){ name = name.replace(/[\[]/,'\\\[').replace(/[\]]/,'\\\]'); var regexS = '[\\?&]'+name+'=([^&#]*)'; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ''; else return results[1];}

    3 Step:
    Go to customize Campaign Response Entity Form and select OnLoad


    var Qcampaign = new Array;
    var lookupItem = new Array;

    switch (crmForm.FormType)
    lookupItem = window.opener.document.all['to'].DataValue;
    Qcampaign= window.opener.document.all['regardingobjectid'].DataValue;

    if (Qcampaign[0].type == 4406)
    if (lookupItem[0] != null)
    crmForm.all.customer.DataValue =lookupItem;