API for interacting with SharePoint from .NET code deployed to the server.

learn more… | top users | synonyms

2
votes
1answer
1k views

Sending an email using sharepoint object model sharepoint 2010

i have been working on generating email in an event receiver using share point object model..i used the sputility.sendemail method..2 things are necessary in the email(email from and HTML body)..so i ...
2
votes
1answer
266 views

SharePoint object model

I'm looking for articles on custom model mapping for Sharepoint (2007 / 2010). Google's not returning a lot of hits on this, are the any articles out there? Best practices, mapping and such? I'm ...
2
votes
2answers
4k views

How to read items in a BCS external list with PowerShell?

Is there a way that you get information from an external list (created from SPD for a specific ECT) differently than you do from a "normal" SharePoint list when using PowerShell? I did the following: ...
2
votes
3answers
132 views

4 using statements looks messy? Any suggestions on what is a better way to code this?

Imagine the following code: using (SPSite spSite = new SPSite(this.SiteURL)) { using (SPWeb spWeb = spSite.OpenWeb()) { using (SPSite spSite2 = new SPSite(this.SiteURL2)) { ...
2
votes
4answers
322 views

Document Library throws NullReferceException everytime I try to grab an item

This code is from a sequential workflow. I am trying to grab the most recent item in a document library. I check to make sure there are more than zero items in the library, then I try to grab the most ...
2
votes
2answers
1k views

Getting SPList object by Guid giving exception “List…does not exist at site with URL”

I am trying to load a drop down list with the same items that a lookup field uses. I thought it would be relatively straightforward, but the line SPList lookupList = ...
2
votes
2answers
212 views

Sharepoint Web Part restrict to zone

Is there any way to restrict a web part to a certain zone? I know I can restrict it by using the AllowZoneChange flag, but is it possible to make sure the web part can only be added to certain zones? ...
2
votes
1answer
463 views

Difference between GUID and UniqueId

What is the difference between GUID and UniqueId? They are both globally unique ids and from the client side we can see they are not the same: ctx = new SP.ClientContext(); web = ctx.get_web(); list ...
2
votes
1answer
93 views

Possible to use the object model to push content across two different web applications?

I've been able to use the object model to move list items between sites in the same site collection, but I'm wondering if I can use it to move list items between two different web applications on ...
2
votes
2answers
504 views

How to enable custom ordering on a list?

I want to be able to create a list programmatically which allows end users to reorder the items in the list. There appear to be 2 steps to this. Firstly set the SPList.Ordered property to true - this ...
2
votes
1answer
746 views

How is a link to a Meeting Workspace stored for a Calendar Event?

If you open the DispForm.aspx for an item in a Calendar List, you see a link and display text to the Meeting Workspace (if one exists) for that event. How can I access the link to the Meeting ...
2
votes
2answers
2k views

Adding Document to a record library programmatically

I have a requirement, where I need to upload a document like invoice report to a record library programatic. I have used the same code as uploading document to a normal document library. Now the ...
2
votes
1answer
170 views

Server side equivalent of this Client Object Model code?

I have the following javascript: SP.ListOperation.Selection.getSelectedItems(); And I'm wondering if there is a Server Side Object Model equivalent to this that I could use in Page Load? The ...
2
votes
3answers
268 views

Deny user access from SharePoint Native but allow it from custom application

How can i restrict a user from entering SharePoint - unless he is using my custom application? For example, a user tries to open http://Mysite , he gets an access denied error. But as the same time, ...
2
votes
1answer
322 views

Setting the value of a custom web part property using object model

Let's say I have a reference to a web part that I got by using a SPLimitiedWebPartManager. How can I set the custom properties of that web part? For example, if it is a stock ticker web part, how do I ...
2
votes
4answers
1k views

WCF Service @ SharePoint 2010 TimeOut

I have been developing on SP 2010 for a while now. Mostly I have been working with the Client Object Model. Though I am at a point where I need to read out the UserProfiles from inside SharePoint. ...
2
votes
1answer
229 views

Unable to seperate normal and hidden folder such as “Forms” [SPFolder Object Model ]

While performing certain task in a console application, i am unable to separate normal folder and hidden ones such as "Forms","FormServerTemplates" etc. I am using SPFolder in the obejct model. I have ...
2
votes
1answer
110 views

Deleting a SharePoint User Profile remotely

Can anyone tell me how to delete a SharePoint user profile remotely? I don't see a way to do this using SharePoint Web Services or User Profile Services. The following code works fine when run on ...
2
votes
2answers
154 views

Is there any way to find documents with similar titles using FullTextSqlQuery?

Say I have a document with the title, Calendar events for December and another document with the title Month of December Calendar of Events. Is there some way to determine that these are very similar ...
2
votes
2answers
1k views

Set custom publishing page layout custom field programatically

I have a custom publishing page content type, based on the Publishing Article Page content type. On this content type, I have a custom field named "PageContentCategory". In my code to create new ...
1
vote
5answers
1k views

for vs foreach when iterating over SPWebCollection

I was just wondering which of the two methods below is more popular, when it comes to iterating over a collection of SPWeb objects. for (int i = 0; i < SPContext.Current.Site.AllWebs.Count; i++) { ...
1
vote
3answers
8k views

How to convert string into SPUser?

I have a string "System Account", how can I convert the string into SPUser? I've tried SPContext.Current.Web.EnsureUser("System Account") and also web.AllUser["System Account"] but hit error. Please ...
1
vote
1answer
2k views

SharePoint 2010 - Change order of User Profile properties

I would like to know how to change the display order of the out of the box user profile properties using sharepoint object model ? I would like to move OOTB properties into my custom section.
1
vote
2answers
434 views

Updating an SPListItem without knowing SPSite or SPWeb

I'm building a custom web part that is running an SPSiteDataQuery. I will be running this query across all site collections, and displaying the results, together, in 1 web part. Users interacting with ...
1
vote
2answers
55 views

Track users opening files from the farm?

Our internal auditors have made a request to produce a regular report that shows when users access certain files. With this in mind I was wondering - is there a way in the object model or otherwise ...
1
vote
2answers
1k views

How do I obtain the SPWorkflow object in the event receiver?

I have a workflow event receiver which is handling the WorkflowStarted and WorkflowCompleted events. I need to obtain references to the workflow list item and the workflow object to do some additional ...
1
vote
1answer
74 views

Checking SharePoint Uptime Remotely

I was wondering how people have gone about programatically checking if SharePoint is still available? I use the following now to check it, but it relies on the SharePoint object model and must run on ...
1
vote
1answer
111 views

What are the largest and smallest values that can be stored in an SPFieldDateTime?

What it says on the tin, basically! I assumed it's the same as a regular .NET DateTime struct, but whenever I try to store 01-Jan-0001 (smallest DateTime value), I get an error. Can't find it on MSDN ...
1
vote
2answers
90 views

How to determine was site updated or not

How do I determine through API if a Sharepoint site updated or not? We are writing a tool that connects to Sharepoint site and downloads it on the local computer as a model. When someone adds or ...
1
vote
2answers
68 views

How memory intensive is a list of SPItems?

I want to create a list which can store SPItems for "offline" reference. I would hope no more than 3000-6000 items. Do you think this is pushing it memory wise? Thanks in advance
1
vote
1answer
213 views

SPWeb.Webs, foreach and var

See below: SPWeb currentWeb = SPContext.Current.Web; foreach (var web in currentWeb.Webs) { // web is object here - why? } SPWebCollection implements IEnumerable<SPWeb> (among other ...
1
vote
1answer
781 views

Programmatically get port 80 Web Application Default URL for Farm?

How would I programmatically get the port 80 Web Application Default URL for the Farm?
1
vote
2answers
87 views

How to create sites taking values from database

In one interview, interviewer asked this question. I have one table in sql server database which contains the Title and its id(int). Now I want to retrieve those values from database and based on the ...
1
vote
1answer
442 views

Dispose issue when working with content types

I am seeing an issue with un-disposed SPRequest objects in the ULS logs when i work with content types in the object model. My code is as follows (in previous methods run as part of this request, the ...
1
vote
2answers
1k views

Programmatically reading static links in the navigation

I'm having a SharePoint site where I disabled the "show pages" option in the navigation, and created my navigation using the add static heading/link option. My problem now is that I tried to ...
1
vote
2answers
714 views

Changing PublishingPage.Layout doesn't change the content type?

I'm trying to update the Layout of the default.aspx page in my SharePoint publishing site and although the Layout does get updated, the ContentType of the page does not. Anyone have any ideas? Based ...
1
vote
2answers
2k views

TaxonomyField.SetFieldValue throws “Specified method is not supported” Exception

I'm trying to copy a list item from one list to another. The lists are on the same site and the code is being fired inside of an item added/updated event receiver). Both lists have managed metadata ...
1
vote
2answers
1k views

Server timeout issue when getting 500000 records from SharePoint 2010 list

I am working on Sharepoint 2010. I want to get 500000 list items from the "Announcement" list. I got server timeout issue and the code is given below SPList list = web.Lists["Announcements"]; SPQuery ...
1
vote
2answers
2k views

Scope in your query does not exist

I'm developing a web part (in VS 2010 for SharePoint 2010) to seach all content in a Publishing Site Collection. I have the following code (just testing before I change the scope and the select ...
1
vote
2answers
2k views

Why httpcontext.current is null in sharepoint 2010 while Implementing the Custom Membership Provider?

SharePoint 2007 we can able to use the Httpcontext.current object But in SharePoint 2010 we are unable to get the httpcontext.current object. It will return the values. How can i get the or Create ...
1
vote
1answer
83 views

Add attachment to Outlook from SharePoint Library

We have a requirement to send Emails from SharePoint with attachments from Document Library. We have been able to achieve this. But now the requirement is client want to open outlook and add ...
1
vote
1answer
426 views

Transfer Multiple people picker column's value from one site to another

I have a column of multiple people picker called Likes in 2007 sharepoint site which stores n number of people. Now i want to programmatically transfer it's content to sharepoint 2010 site. Problem ...
1
vote
2answers
61 views

Accessing the version on an SPFolder

Within a Document Library with versioning turned on, I noticed that if I create a folder and "View Properties" that there is a "Version: 1.0" that is listed as a property along with "Created By", etc. ...
1
vote
2answers
314 views

SharePoint Data Modelling Tool

I plan to develop a data model for a SharePoint application that we would like to bid out for development. Is there a data modelling tool that is preferred to be used with SharePoint, like it can ...
1
vote
2answers
747 views

how to open version history using SPSecurityTrimmedControl

I am using SPSecurityTrimmedControl to view version history of list for users who have more than read permissions like this <.SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" ...
1
vote
3answers
520 views

I cant hide the Title field programatically

I am trying to hide the Title field so it does not appear in add/edit forms. I am using web templates. The title is hidden in the sitecollection but not in any of its sub sites. Below is my code. ...
1
vote
1answer
351 views

What permissions are required to access SPSite.Usage?

I am using the SPSite.Usage property in the object model to get statistics on the size of a site collection in SharePoint 2010. With my own user account being a farm administrator, site collection ...
1
vote
1answer
172 views

What are “unsafe updates” for list items?

In the SharePoint 2010 server-side object model the SPWeb Class has a property "AllowUnsafeUpdates". What are unsafe updates in connection to list item changes? How are they to be delt with in code? ...
1
vote
1answer
2k views

How to programmatically read the contents of InfoPath form?

I have form with data in repeating table. I need to use the object model to read the contents and display it on a webpart. Is it possible? Can any of you help me?
1
vote
1answer
932 views

Retrieving the values from the list view SharePoint 2010 using object model

I have a list (tick_gen) which has a view called "tick_dView" this view just has one row. How can I fetch the value of "Tick_id" column using SharePoint object model?