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

learn more… | top users | synonyms

4
votes
2answers
1k views

Is it possible to have a single document referenced by two different document libraries?

Business Requirements: My customer wants to be able to associate one document with multiple projects. E.g., a set of specifications for a piece of equipment that will be used in multiple projects. ...
0
votes
1answer
2k views

Getting SPUser object from “Group or People” SPListItem field

I am using a Powershell and CAML query to return items from a list. The list contains a "Group or People" field in which I have not seeing how to get the email and login information of the user. 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 ...
3
votes
1answer
789 views

Using GetDataTable() hoses my SPFieldLookValueCollection!

I am trying to use GetDataTable on an SPListItemCollection. I have run into a situation where my SPFieldLookupValueCollections in this list are being converted to a string when they are stored in the ...
1
vote
2answers
983 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 ...
2
votes
3answers
265 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, ...
1
vote
2answers
678 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 ...
4
votes
3answers
791 views

What options are available to me to find lists that were created using a specific list definition?

I have many lists, some of which were created using a custom and now-obsolete list definition. I need a programmatic way of finding out which lists were created using that old definition. Currently ...
4
votes
2answers
322 views

Efficiently determine if a List is using item level security

How can you efficiently determine if any of the items in a List don't inherit their security from the List? You could use SPListItem.HasUniqueRoleAssignments but this would require iterating through ...
0
votes
1answer
704 views

SharePoint Object Model: how to query ONLY last major version of data from Publishing Page?

I came into a situation where I wanted to use SharePoint Object Model SPSiteDataQuery to query data from Publishing Page. However, I dont want the data query based on the permission on current login ...
2
votes
3answers
1k views

Programatically searching the current site collection only

I'm trying to programatically search a sharepoint site. The problem is, the results returned are from all site collections. How can I limit my search to only one site collection. Here is how my code ...
1
vote
2answers
4k views

Performance of Client Object Model vs. Server Object Model

We are looking to deploy an Intranet using SharePoint Foundation. I am targeting the Client Object Model for this project to avoid Master Page customization and building custom Webparts and leverage ...
2
votes
1answer
347 views

SPDocumentLibrary.CheckedOutFiles does not return all files

I am working through some code samples on MSDN that is suppose to return Checked Out files but my tests is showing a problem. Here you can see that both "default" and "foo" in my Page library are ...
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 ...
1
vote
1answer
1k 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?
0
votes
2answers
277 views

Event reciever (itemadded) sharepoint 2010

is there a way where we can get the link(editform.aspx) of item just added to the list-- in the itemadded method of the event receiver (Share Point object model)
4
votes
1answer
5k views

Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack

this code thow an exception at "Item.Update();" private void AddEmail() { site = SPContext.Current.Site; web = site.RootWeb; ...
1
vote
2answers
88 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
1answer
917 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?
2
votes
1answer
265 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 ...
3
votes
3answers
1k views

How to create InfoPath forms dynamically?

I have an InfoPath form published to a library... I need to create forms dynamically with siteuser as form name... I need to achieve it in Object Model... Can any of you help me on this...?
0
votes
1answer
662 views

How to create a SPUser object from its XML representation

I have the following XML representation for a user: <pc:Person xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls"> <pc:DisplayName>John ...
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 ...
0
votes
1answer
116 views

How do I read pagecolumns from the current page

I know that I have to use SPSite site = new SPSite("SPsite Path"); SPWeb web = site.OpenWeb(); SPList contacts = web.Lists["Listname"]; if I need to get content of a List, but how do I read data ...
2
votes
2answers
150 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 ...
18
votes
3answers
1k views

Feature based XML vs. Object Model: Which is better for content type development?

I've been researching a few different ways to create content types and I recently discovered that you can use the Object Model to do this. All of the examples I have found online typically use XML ...
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: ...
1
vote
1answer
1k views

Getting hold of the document sets in a library

I am sure something wrong with the following code. There are over 400 document-sets in the library and script only shows 8. Please suggest which line is messed up. (At one time I could get this work) ...
0
votes
1answer
127 views

Tagging documents in SharePoint

Can we tag individual SharePoint documents? If so, how can we read the tags of a document using SharePoint object model?
1
vote
1answer
602 views

Use of SPRequest class in SharePoint Object Model

Can any one explain what exactly does SPRequest class do and for what function we must use it? Thanks in advance.
0
votes
1answer
2k views

GridView control - paging with linq. Where is objectDataSource?

I have visual web part with custom logic which retrieves me strongly typed list (not SPList -> .NET list object) which than I bind to gridview which has paging enabled. That works fine. Problem is: ...
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 ...
11
votes
4answers
6k views

How to automate entry of external column data in BCS?

I have a document library, Resumes, that has a large number of resumes in it. There is a regular column on that library, called EmployeeID, that is already populated. I have an external content type ...
4
votes
2answers
3k views

Iterate through discussion list

I have SharePoint 2007 discussion list. I want to iterate over all items in the list, so I do the following: var list = web.Lists["discussion"]; var listItems = list.Items; foreach (var listItem in ...
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
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)) { ...
6
votes
3answers
23k views

Sharepoint 2010 how to get all items in a folder contained in a list?

I have a list that contains folders. Using c# and object model, how can I see if the folder contains any items, or return a collection of all the items in that folder.
4
votes
1answer
2k views

How do I remove all users from an SPGroup object?

I have an SPGroup object populated, how can I remove all members from the group, so that essentially I start with a fresh group. I can't delete and recreate it, so I need a way to work with the ...
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.
4
votes
2answers
408 views

Performance of search vs. using the object model?

Does anyone know how the performance of searching for items compares to using the object model to access them? When I say "object model" i mean using SPList to get a collection of SPListItems and ...
1
vote
1answer
589 views

Why are SP objects (such as SPUser) not serializable?

I tried to create some private variables that were SPUser's, but I was given an error to the tune of 'SPUser is not marked as Serializable'. Why? I know these objects contain a lot of contextual ...
0
votes
1answer
115 views

Proper way to retrieve list data asynchronously?

I have done this in the past using jQuery's ajax function and the SharePoint web services, but I'm curious if it is considered a better practice to use the Javascript Object Model? Also, is it secure ...
3
votes
1answer
932 views

Creating Managed Metadata Field from XML definition

I have successfully recreated all other Column types in SharePoint using the SPFieldCollection.AddFieldAsXml(string xml) method. However, the same method fails for the TaxonomyFieldTypeMulti field ...
26
votes
2answers
7k views

When to use OpenWeb() vs RootWeb

I am a little confused on the pro's and con's of each. When is it good to use OpenWeb() vs RootWeb, especially in the context of a using statement.
6
votes
3answers
2k views

How can I modify a file stored in SharePoint via PowerShell?

I have some files in SP 2010 that are simply HTML, and I need to modify the contents of those files in a systematic manner. Is there a good way to do this using powershell? Imagine that I want to ...
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 ...
0
votes
1answer
1k views

how can i get Web Analytics database name with Object Model?

First let me say, that all of we doing in sharepoint is base on the object model, so i can go to Central Administration and get my "Web Analytics Service Application" Database Name and Server Name, ...
1
vote
2answers
425 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 ...
5
votes
1answer
447 views

Custom Web Service not cannot find User

I have created a Custom Web Service for my .NET application that performs various functions against a Sharepoint 2010 site. I use a standard function to run each function as an impersonated user (so ...
0
votes
2answers
645 views

Add site column to site content type error

var objWeb = properties.Feature.Parent as SPWeb; Guid webPublishingGuid = new Guid("94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb"); SPFeature feature = null; SPSite site = objWeb.Site; feature = ...