sharepoint-api

Rights issue on SPSite.RootWeb access

The code below throws an exception when I try to access the site.Rootweb property. I suspect it is a rights issue, but no matter waht I do I cannot resolve it. Any ideas? using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint; using Microsoft.SharePoint.Administration; namesp...

Script SharePoint crawl rules

I want to exclude certain pages from MOSS indexing like a confirmation page that sits in the pages library in the root of my site: http://server/Pages/ConfirmSignup.aspx I can do this by going to search administration / search result removal and adding the url to the URLs to remove box. Because I have dev, staging, uat, production envi...

Creating a calendar event in SharePoint

Hi, I need to create a recurring event in SharePoint calendar. I am able to create non-recurring events. Please help. ...

Will using a SPListItemCollection returned from a function reopen the SPWeb?

After reading Stefan Gossner's post about disposing objects and this question about Cross method dispose patterns, I found that I was guilty of accidentally reopening some SPWebs. I know in Stefan Gossner's post he mentions you should dispose of an SPWeb after you are finished with any child object. However, the microsoft documentation m...

Accessing SharePoint Event Attachment

I have a SharePoint calendar event that can have any type of file as attachment. Is there any way to access the contents of the file/ download them? I have to calculate the check sum of these files. ...

What developer features excite you the most for WSS 4.0 / SharePoint 2010?

There's been a lot of developer frustration working with SharePoint but we all hope Microsoft has been listening. With that in mind... What updated and new features for developers excite you about working with WSS 4.0 and SharePoint Server 2010? One answer per feature please so the community can vote on each one. ...

Changing SPList Inherit Parent Permissions property using C#

Hi, I have a Document Library for which I need to add a user (SPRoleAssignment object). But since the SPList inherits the Roles from the parent web, it does not allow me to add for this SPList object alone. To add SPRoleAssignment object to this list alone, there is an option in UI, to create a separate copy of permissions for this SPLi...

How to find the URL of a SharePoint web application given the url of a Site within that

Hi, I need to find the URL of the web application of a given Site (say I have an url http://code/sites/java. Given the url of this site collection i need the URL of the web app that hosts this site collection. In this case it will be http://code. ) Any input will be appreciated. ...

Creating SharePoint WikiPage Items using Object Model

Hi, I have created a SharePoint wikipage library using C#. Now when I try to add files to the WikiPage library using SPFileCollection.Add method and click at those files, they appear in a separate browser window. They do not come up in the sharepoint window itself as in case of a WikiPage created from the SharePoint UI. What am I doing ...

Re-creating a file in SharePoint

Hi, I have developed a sharepoint application using object model. It reads the contents of the file using SPFile.OpenBinary() object and saves the contents of the file in the local disk. When I try to create the same file again with the saved content, the file size differs. And this happens only for office application files (.doc, .xls ...

Getting permissions of a user in SharePoint 2K3 List

Hi, I have been using SharePoint server 2003. I need to retrieve the list of permissions using SPList.Permissions.Xml. But I dont find the permissions given to the user anywhere in the Xml returned. Say I have a user 'A' whose Login name comes as an attribute in the Xml. But the permissions (such as View, View&Insert, View&Insert&Delet...

How can a web part know it's EditorPart is open

I've created a web part with a custom editor part. Now I want to make changes in the behaviour of the web part if the editor part is open. I can almost get it to work by setting a flag in the CreateEditorParts() method except that also fires when the user clicks "OK", "Apply" or "Cancel". The page will render without the editor part op...

Error while creating a new sharepoint site using sharepoint object model

I get the famous error "The security validation for this page is invalid. Click Back..." while creating SharePoint sites using the object model... This is my code in the web part to create share point sites. using (SPSite objSite = new SPSite(SPContext.Current.Site.ID)) { objSite.AllowUnsafeUpdates = true; using (SPWeb objWeb =...

Sharepoint SPWeb rename - Exception SPException - The security validation for this page is invalid.

When attempting an SPWeb rename I receive the following SPException: Exception SPException - The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again. - Failed to create workgroup registration entry Any idea what might be the troubles here? Here is the relevant ...

how to add a new Task in a SharePoint Tasks List [programatically]

I am trying to add a new task to an existing SharePoint Tasks List using Visual Studio 2008 and SharePoint API, my code is: using System; using System.Collections; using System.Configuration; using System.Runtime.InteropServices; using System.Xml.Serialization; using System.Data; using System.Linq; using System.Web; using System.Web.Sec...

How to set a SPFieldDateTime's value?

I'm trying to duplicate a SPFieldDateTime's value into another SPFieldDateTime in an event handler and I have to admit, I'm stumped. There are no obvious fields I can set in an SPFieldDatetime and the following doesn't change my field's value: { SPListItem task = (SPListItem) properties; task[/* destination field's guid */] = tas...

Add Site and Page Description to SharePoint Search Index

Hi, As part of a SharePoint solution, the functionality for users to create new web sites and publishing pages (programmatically) via a button click has been added. I need to ensure that the Description field for the newly created sites and pages is indexed by SharePoint Search. What is the best way to do this? Please note, I am NOT in...

Trouble with SPFieldLinkCollection.Reorder: Isn't working as documented.

I am working with a custom list I've built in SharePoint. I have a feature which has an event handler that kicks off when the feature is activated. That event handler calls (I can debug and watch it execute) the following function: I'm intending that the function behaves as described here. private void OrderFields(SPWeb web) { // ...

Retrieving SharePoint Services Site Column Data

Hello SO Experts, I am new to SharePoint Services and I hit a wall with one of my tasks. I need to retrieve data from a Site Column. How do I get about that? So far I only see APIs that can retrieve lists and not site columns. Please let me know if any of you know to do this. Thanks !! ...

Migrating a ListItem with a custom ContentType and Workflows between MOSS and WSS

Hello, I have a ListItem, with a custom ContentType that have personalizad Workflows, running in MOSS 07 Enterprise. I want to duplicate that ListItem into Servers with WSS, that will see that ListItem as readonly. And I want to use the Microsoft.SharePoint.Deployment, but I'm open to other solutions... Can i do that? Thanks in adv...