dinsdag 27 december 2011

Active Directory from extranet to intranet domain... Impersonation


Crap, created a application page that reads Active Directory on a Intranet.
But the infrastructure department has deployed it on a sharepoint on the Extranet domain.

Result, could'nt query the additional information in the Active Directory of the users on the intranet.
Somebody told me to use impersonation, but have no experience with this. If someone can help me... 
don't hesitate...

If I found a solution, I will keep you informed...
   

donderdag 15 december 2011

Access Active Directory in Sharepoint Application Page


Had to create a redirection page this week that forwarded some Active Directory information 
to an external Site for automatic loggon. When deploying my solution to the Sharepoint Server 
my code didn't worked for normal users. Found the solution that my testing user 
had Farm Admin privileges, for accessing the Active Directory normal users 
had'nt enougth rights to excecute the AD call.

Solution found on msdn was to elevate the privileges for specific part of code 
that needs that kind of rights.


SPSecurity.RunWithElevatedPrivileges(delegate() {
// YOUR CODE THAT NEEDS ELEVATED PRIVILEGES
});
 

dinsdag 15 november 2011

How to update a Hyperlink column


Today I had a little problem for updating a Hyperlink Column by using the List.asmx web service. 
I wanted to insert a New item with a Hyperlink Column but not only by giving the URL. 
So I searched how to add the description to the Column. 
Quickly found that you can use a comma to indicate the URL in the first part 
and the description in the second part. 

But as you know Sharepoint you must follow certain rules that where not 
descripted in the SharePoint Documentation.

So if you need to do the same, keep in mind next rules...

For updating or inserting a Hyperlink value in a Sharepoint list using the List.asmx web services,
make sure to follow these guidelines:
- Notice that URL needs to include “http://” e.g. http://www.google.com/
- If you want to specify a description, 
  make sure to include a space between the comma (,) and the description.  

So our URL field value needs to have ,,
e.g. http://www.google.com/, Google.

batch example:
<Batch OnError=\”Continue\”> 
 <Method ID=\”1\” Cmd=\”New\”> 
     <Field Name=\”URL\”>http://www.google.com, Google</Field> 
    </Method> 
</Batch>
 

vrijdag 11 november 2011

Building CAML Query, useful site



Building CAML Query
Found this useful site details about building CAML query.

Useful tool for building a CAML query:
- U2U CAML Query Builder

Enjoy it...

How to format decimal in SharePoint Dataview


To translate numbers in SharePoint Dataview, SharePoint Designer generates
following code:

<xsl:value-of select="format-number(@YourField, "$#,##0.00;-$#,##0.00")"/>

Examples:
YourFieldResult
1234512,345.00
1234.51,234.50
0.0 0.00
If YourField contains a "," you need to use the decimal-format functionality which will get you something like this: Outside the xsl:template block: <xsl:decimal-format name="European" decimal-separator=',' grouping-separator='.' /> To display the field: <xsl:value-of select='format-number(translate(@YourField,",","."), "#.##0,00", "European")'/> Examples:
YourFieldResult
1234512.345,00
1234.51.234,50
0.0 0,00

woensdag 9 november 2011

How to Add a Windows SharePoint Web Service Reference


You can add a Web reference to each SharePoint Web service
through your Visual Studio .NET IDE. In your Solution Explorer, 
right-click on your project and select "Add Web Reference"
from your popup menu.
The table below shows the URLs to use for each Web service provided by WSS.
Enter the URL to the Web service and click the Go button.
This will show you a summary of all available Web methods in the dialog box.
Next, enter the name of the Web reference and then click Add Reference.
WSS Web Services Web Reference
Administration Service http://[server-url:port-number]/_vti_adm/admin.asmx
Alerts Service http://[server-url]/_vti_bin/alerts.asmx
Document Workspace Service http://[server-url]/_vti_bin/dws.asmx
Forms Service http://[server-url]/_vti_bin/forms.asmx
Imaging Service http://[server-url]/_vti_bin/imaging.asmx
List Data Retrieval Service http://[server-url]/_vti_bin/dspsts.asmx
Lists Service http://[server-url]/_vti_bin/lists.asmx
Meetings Service http://[server-url]/_vti_bin/meetings.asmx
Permissions Service http://[server-url]/_vti_bin/permissions.asmx
Site Data Service http://[server-url]/_vti_bin/sitedata.asmx
Site Service http://[server-url]/_vti_bin/sites.asmx
Users and Groups Service http://[server-url]/_vti_bin/usergroup.asmx
Versions Service http://[server-url]/_vti_bin/versions.asmx
Views Service http://[server-url]/_vti_bin/views.asmx
Web Part Pages Service http://[server-url]/_vti_bin/webpartpages.asmx
Webs Service http://[server-url]/_vti_bin/webs.asmx

Error while creating a new page in SP 2007.


Are you getting the below error while creating a new page in SP 2007 while using publishing 
or collaboration portal template?
List does not exist The page you selected contains a list that does not exist.

It may have been deleted by another user.

at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListsWithCallback(String bstrUrl, Guid foreignWebId, String bstrListInternalName,
                         Int32 dwBaseType, Int32 dwBaseTypeAlt, Int32 dwServerTemplate, UInt32 dwGetListFlags, UInt32 dwListFilterFlags, 
                         Boolean bPrefetchMetaData, Boolean bSecurityTrimmed, Boolean bGetSecurityData, ISP2DSafeArrayWriter p2DWriter, 
                         Int32& plRecycleBinCount) 
at Microsoft.SharePoint.Library.SPRequest.GetListsWithCallback(String bstrUrl, Guid foreignWebId, String bstrListInternalName, Int32 dwBaseType, 
                         Int32 dwBaseTypeAlt, Int32 dwServerTemplate, UInt32 dwGetListFlags, 
                         UInt...


 

Resolution
Go to Site Settings
            - Modify All Site Settings 
            - Master pages and page layouts
            - Add the usergroup who may create sites to the list with Read Restricted Access rights