New answers tagged

0

The old ‘Open Library in Explorer View’ option in SharePoint may get you out of trouble if the directory structure and number of files is fairly small. Simply use the Explorer View to open the SharePoint library up in a Windows Explorer window and then copy/paste or drag/drop into the Window and the magic will start to happen. If you want to move ...


0

You need to change these lines SPQuery objQuery = new SPQuery(); objQuery.ViewFields = string.Format(DROPDOWNLIBRARY_FIELDS, "AGENTID_FIELD","ID_FIELD", "CREATED_FIELD","SALES_FIELD", "SUBMITTEDDATE_FIELD"); ... DataTable fSDataTable = List.GetItems(objQuery).GetDataTable(); With below code SPQuery query = new SPQuery(); string[] viewFields = new ...


0

Roshan, I was reviewing the code which you have shared, there is a line where you need to do the modification. The below code is in the solution you posted, you need to change the ".xls" to ".xlsx" from the excelFilename with Path. This should resolve the issue with Excel version you are having. string excelFileName = string.Format(@"D:\SPListData\...


0

Finally I found the reason The file.Length property is available only on SP 2013 site. When I tried to run my application on SP 2010 site I am getting the exception because the SP 2010 doesn't have file.Length property Refer:File Properties - SharePoint 2010


1

There are many options to do it. Like SharePoint Designer Workflow Remote Event recievers JavaScript For your requirement follow the steps below, Step 1: Set Up the Visual Studio 2010 Project for the ECB Menu Item Solution Step 2: Create the Edit Control Block Menu Item Step 3: Create a Web Application Page to Start Conversions Step 4: Embed the code ...


1

I have updated your code to insert & update item using Dictionary<string, List<string>> instead of HashTable. Kindly check it. foreach (DataRow dr in dt.Rows) { static Dictionary<string, string> htValues = new Dictionary<string, string>(); string ITEMNMBR = dr["ITEMNMBR"].ToString(); string ItemDesc = dr["Item Desc"]...


-1

First debug it and get to the line where the error is occurring. As far I see the problem you are having is that your site path is not specified correctly. Your FullUrl = @"http://servername/sites/xyz/default.aspx"; instead try string FullUrl = @"http://servername/";


0

While loading the listItems you need to explicitly include FieldValuesAsText like below: context.Load(listItems,items=>items.Include(item=>item.FieldValuesAsText)); This will save you from the not so pretty approach of Regex as mentioned in the accepted answer.


4

You cannot change the parent content type of a content type: The Parent property is read-only. The content type ID is prefixed with the parent content type's ID. See explanation here which is for SP2010 but it works the same for SP2013. You have to basically re-create the content types using the correct parent from the start.


0

Change your onSuccessMethod with below one with proper id: function onSuccessMethod(sender, args) { document.getElementById("your input control's id").value = web.get_title(); }


0

I have frequently encounter this bug first reason is: we should fill required field by call correct name for example: string siteUrl = "http://sharepoint-server/"; ClientContext clientContext = new ClientContext(siteUrl); //Announcements SP.List oList = clientContext.Web.Lists.GetByTitle("Contacts"); ...


1

When you are working in visual webpart, you can add css & javascript in following ways. Option 1: Open your ascx file in the webpart. Add <style type="text/css"> </style> tag Add your css properties into this style tag. Use the classes in you html block. Option 2: Create a text file. paste entire css code in it. Do not add <style>...


1

If you want to apply the CSS to your Google Organization Chart webpart than you can just apply it from the ASPX page like (Usual way) below. <style type="text\css"> .google-visualization-orgchart-node { text-align: center; vertical-align: middle; width: 139px !important; font-family: arial,helvetica; font-size: 12px !important; cursor: default; border:...


1

i resolved the issue by applying bellow code code for retrieving current user using (SPSite site = new SPSite(SPContext.Current.Web.Url)) ; { SPUser user = SPContext.Current.Web.CurrentUser; var userLoginName = user.LoginName; SPServiceContext serviceContext = SPServiceContext.GetContext(site); var ...


1

try the bellow code that is for retrieving current users data include the name spaces using Microsoft.Office.Server.UserProfiles; using Microsoft.SharePoint; using Microsoft.SharePoint.WebControls; apply the following code using (SPSite spsite = new SPSite(SPContext.Current.Web.Url)) ; { SPUser spuser = SPContext....


2

Solve the issue after installing Microsoft Office Developer Tools Preview 2 for Visual Studio 2015


0

100 is a server imposed limit to support paging. To bypass you should use $top in your query. Recommended approach is to keep the 100 limit and page through the result using _next return value.


0

EnableAssignToEmail property is not available in CSOM. So there is no way set incoming emails through CSOM but it's possible through PowerShell Scripts. https://officespdev.uservoice.com/forums/224641-general/suggestions/7402411-enableassigntoemail-list-method-missing-on-list-ob


0

Try with this endpoint url, https://<site url>/_vti_bin/ListData.svc/<List Name>/$count


2

Change your CreateNewRow function with below code. public partial class OrganizationChartUserControl : UserControl { //Get the List name to fetch the data from string listName = "OrgChart_Demo"; int iRowCounter = 0; string sAllNewRows = string.Empty; protected void Page_Load(object sender, EventArgs e) { //Fetch the data (...


3

This code should work: (web is a variable that references the web object) SPFieldUserValue value = new SPFieldUserValue(web, item["AssignedTo"].ToString()); if (value) { assignToUser = value.User; }


2

You can try below code to get SPUser in AssignedTo columns for specific item. If(task["Assigned To"] != null) { string fieldValue = Convert.ToString(task["Assigned To"]); SPFieldUserValue assignedTo = (SPFieldUserValue) task.Fields["Assigned To"].GetFieldValue(fieldValue); }


2

Try this SPFieldUserValue userField = item.Fields["AssignedTo"] as SPFieldUser; string userName = item["AssignedTo"].ToString(); SPFieldUserValue fieldValue = (SPFieldUserValue)userField.GetFieldValue(userName); SPUser user = fieldValue.User; Taken from http://ethan-deng.blogspot.com/2013/03/get-spuser-from-user-column-there-are.html


2

You can try below code, using (SPSite siteCol = new SPSite("http://server/sites/Contoso")) { using (SPWeb web = siteCol.RootWeb) { SPList list = web.GetList("/sites/Contoso/Lists/Books"); SPListItem item = list.GetItemByIdSelectedFields(3, "Title", "ISBN", "Retail_x0020_Price"); String bookISBN = ...


1

The below code demonstrates how can we fetch Active Directory (AD) using Directory Service. For this, I'm using object array (Users) and here is the structure: public class Users { public string Email { get; set; } public string UserName { get; set; } public string DisplayName { get; set; } public bool isMapped { get; set; } } The code ...


1

User's Properties from Active Directory can be achieved through profile synchronization. In Central Administration, verify settings on user profile service synchronization properties Run “User profile service synchronization" service. This will update all the user profile information With the help of CSOM and REST API you can perform an activity to ...


0

You need to know Active directory programming with C#. Following reference is very helpful. Howto: (Almost) Everything In Active Directory via C# This section will help you to read user properties like joining date and etc.


0

Try this: clientContext.Credentials = new NetworkCredential("username", "password", "domain");


0

One option may be to replace spWeb.SiteUsers.GetByEmail with spWeb.EnsureUser. Even though the documentation indicates that EnsureUser accepts a user's domain\username as a parameter, in practice I've found that an email address works as well, although this may be dependent on your environment's configuration.


1

Follow Method that takes a SPWeb object and a SPUser object. SPServiceContext serverContext = SPServiceContext.GetContext(web.Site); UserProfileManager profileManager = new UserProfileManager(serverContext); string userString = user.LoginName.ToString(); UserProfile userProfile = profileManager.GetUserProfile(userString); if (userProfile != null) ...


1

You can use below code snippet to follow a site //GET USER PROFILE MANAGER SPServiceContext serverContext = SPServiceContext.GetContext(siteobject); UserProfileManager profileManager = new UserProfileManager(serverContext); UserProfile profile = profileManager.GetUserProfile(loginName); if (profile != null) { //Social following manager object for the ...


0

You should run the query when a submit button is pressed, or when the dropdown is changed, not on page load.


0

You can use JavaScript method: SP.UI.ModalDialog.showmodalDialog(options) Check MSDN for syntax and example.


0

The function below needs only the url path of a file in Sharepoint server, saves it at local directory and finally returns the file's path. It does not use the sharepoint client csom api. It also works with versions of a document, if you have enabled the versioning property of sharepoint document's library. public string DownloadFile(string urlPath) {...


1

Try below method as detailed by skeletank: private IEnumerable<string> GetAttachmentUrls(SPListItem item) { return from string fileName in item.Attachments orderby fileName select SPUrlUtility.CombineUrl(item.Attachments.UrlPrefix, fileName); }


0

Hope you want to group by the LookupId, so you could do something like this: var items = list.Items; var groupedItems = items.OfType<SPListItem>().GroupBy(item => new SPFieldLookupValue(item["Related"]).LookupId); The mistake should be you have converted the Object to string, then converting it to SPFieldLookupValue and trying to get LookupId ...


1

The purpose of Client Object model is to access SharePoint data from systems where the SharePoint is not installed like web services. Server object model is used to access data only SharePoint installed systems. If you want to access data from production environment and you are not having access to that machine, in this scenario you should use Client object ...


1

In CSOM, RunWithElevatedPrivileges cannot be used. Code always runs under the context of current user.


0

Delete property item from Elements.xml <File Path="Default.aspx" Url="Default.aspx" Type="GhostableInLibrary" ReplaceContent="TRUE"> <!--<Property Name="Title" Value="Default"></Property>--> </File> This helped me


0

try with this: eventDate.ToString("s"), endDate.ToString("s")


0

As far as I know, there is no simple supported way to achieve this directly (I think you may be able to put together some sort of workaround that uses ASP literal controls, but even if possible I would try to avoid it). I would therefore consider another option. Since your localized text is going to be used in a JavaScript script, why don't make the ...


1

Why not just secure the content with a workflow if the status changes? If it's secure it will not show in search. You could also eliminate the content from the default result source, but I'd prefer security.


4

Your webpart is behaving like this because your are not handling postbacks correctly. Wrap all code in the Page_Load method with the following if(!Page.IsPostBack){ // Original code here } Some info about PostBack here: http://net-informations.com/faq/asp/ispostback.htm Or, just before your new databinding of the grid do this GridView1.DataSource = ...


0

web.SiteGroups.Add(groupName, web.SiteAdministrators[0], web.SiteAdministrators[0], ""); SPGroup group = web.SiteGroups[groupName]; // Add the group's permissions SPRoleDefinition roleDefinition = web.RoleDefinitions.GetByType(SPRoleType.Administrator);//Add Role Type as Administrator(Full Control),Contributor and Editor etc. SPRoleAssignment roleAssignment =...


0

Search also has the ability to remove result by URL. You could enter the URL of the canceled page manually and it will be added to the crawl rules and no longer be returned as a result.


0

Maybe you could make a search scope. You would need to make your column a "managed properties" and then add 4 rules for = everything but canceled.


0

You first need to finalize that which kind of page do you need like Application Page or Site Page? Using the most basic definition, a site page is customizable by an end user while an application page is not. That means that a user can pop open SharePoint Designer 2010 and make changes to a site page, but they cannot do this with an application page. So, ...


2

Please use below query to compare birthday with current date. SPQuery = new SPQuery(); query.Query = "<Where><Eq><FieldRef Name='Ditlindja' /><Value Type='DateTime'><Today /></Value></Eq></Where>"; By using variable DateTime date = DateTime.Now; SPQuery = new SPQuery(); query.Query = "<Where&...


2

it is due to dll version, check the version compatability,if the version mismatch it will not compile


0

One more piece to add to that answer... I was installing from the server's IE browser but was failing with this error. Did the exact same process from a client IE's browser and then it worked.



Top 50 recent answers are included