Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all 7589 articles
Browse latest View live

How to attach a default master page to a aspx site page ?

$
0
0

Hi

I make a aspx file in the sharepoint designer 2013, and I place a hyperlink inside the form.

It do well

Then I try to attach a master page.

In the sharepoint designer menu I click at the style button, then click at the attach button and select
the default master page "oslo"

But when I open the site in the internet browser, the site comes with an error.

Below here is the code before and after attaching the master page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ Page Language="C#" %>
<%@ Register tagprefix="SharePoint" namespace="Microsoft.SharePoint.WebControls" assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
<meta name="WebPartPageExpansion" content="full" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 2</title>
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<SharePoint:CssRegistration Name="default" runat="server"/>
</head>

<body>

<form id="form1" runat="server">
<asp:HyperLink runat="server" id="HyperLink1">HyperLink</asp:HyperLink>

</form>

</body>

</html>

%@ Page Language="C#" masterpagefile="~masterurl/custom.master" title="Untitled 2" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" meta:webpartpageexpansion="full" meta:progid="SharePoint.WebPartPage.Document" %>
<%@ Register tagprefix="SharePoint" namespace="Microsoft.SharePoint.WebControls" assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<asp:Content id="Content1" runat="Server" contentplaceholderid="PlaceHolderUtilityContent">

<form id="form1" runat="server">
<asp:HyperLink runat="server" id="HyperLink1">HyperLink</asp:HyperLink>

</form>

</asp:Content>



SharePoint Designer 2013 no Design View

$
0
0

Dears friends:

I recently discovered that SharePoint Designer 2013 has not Design view. Only Code view.

From everything I've seen in SharePoint since 2001, honestly this is the most -mmm- how to say not to sound so ugly? ... "irrelevant" as I can remember ...

For starters, if you do not have Design view, then it should be called SharePoint"Designer" ... now be simply "SharePoint Encoder" or"SharePoint Programmer" ...

I checked the arguments responsible for this change in Microsoft, and anything that poses as relevant as it seems to remove this feature Designer ... in fact, I think they're just killing this application, because if I want to edit code, I served up Notepad.

Moreover, the true grace of SharePoint Designer is that-as the name indicated-enabled visually customize pages, without going into the code, which I and perhaps many more who are not programmers, was what we liked the program.

Finally, the manager argued that "now SharePoint sites can be designed in any design program" ... and that hurt me even more, because I spent years arguing with me saying "you can used Dreamweaver" or other editors, and always answered was precisely for that is "SharePoint Designer"...

Anyway, I think that Microsoft's many bright people, and most are very smart, but sometimes I think -excuse the frankness- there are some idiots.

Alexis López Tapia
CEO
Kyberne.com S.A.
www.kyberne.com
gerencia@kyberne.com


How to avoid REST call on page refresh

$
0
0

Hi All, I am new to REST. I am trying to get data from Announcement List using REST API oData call. I observed in the Fiddler that the REST call is being made on page refresh too. How can I avoid REST Call on page refresh?

<script>
$('#oDataAnnouncements').innerHtml ="";

    jQuery.ajax({

        url: "<WebSiteUrl>/_api/Web/Lists/getByTitle('Announcements')/items",
         type: "GET",
        headers: {"accept": "application/json;odata=verbose",
        },
        success: function(data){
            jQuery.each(data.d.results, function(index, item){
                 jQuery('#oDataAnnouncements').append("<li>" + "<a href=" + "<WebsiteUrl>/Lists/Announcements/DispForm.aspx?ID=" + item.ID + ">" + item.Title +   "</a></li>");
             });
        },
        error: function(error){
            alert(JSON.stringify(error));
        }

});

</script>

oDataAnnouncements is a div where I am putting the REST result. I know I can clear the content of the div to prevent displaying same data on page refresh. It's just that I want to know if I can avoid REST call repetedly.

Thanks,

Khushi


Khushi

How to overcome limitation of file name or limit on length of url in sharepoint

$
0
0

Hi,

I have a backup of data from client. which contains files of various format ex: .pdf, .doc, .xlsx

File name is also large. i created an utility to upload those files to sharepoint but i get an exceptionfile name or folder name can exceed 160 char....

I know complete url length could exceed more than 260 chars and client can not compromise with changing file names as its about to change 50 gb files. How could i overcome this situation?

Is there any way to encrypt file while uploading and when get uploaded show original name. and when comes url show some encrypted url....like this or any good option i can do.

Please reply!

Thanks,

Problem with VS2012 and Sharepoint 2013 Solution

$
0
0

Hello everyone

I've got a problem that's driving me crazy. I'm migrating a Sharepoint 2010/Visual Studio 2010 Solution to Sharepoint 2013/visual Studio 2012 with the developer tools.

My solution consists of 3 class libraries (common, data access layer and business logic) and a Sharepoint 2013 project containing the features, and the webparts using the output of the class libraries. The references inside projects are set through "Add Reference -> Solution -> Projects". I want a wsp-file containing the sharepoint artifacts and the assemblies from my class libraries. (those are added through the package explorer -> Advanced). If i use Build/Rebuild on the Solution it compiles fine, as it should.

If i use the "deploy" or "publish" command on visual studio to create a solution package, the build fails with the message:

"The type or namespace name 'whatever' does not exist in the namespace 'Xyz.Project'' (are you missing an assembly reference?)

I can't find out what's wrong. if i deploy anything manually everything works fine. building/rebuilding my whole solution works fine. Everything is set to .NET 4.5. It seems to be that "wsp-package"-building process that has a problem.

Any hint/idea would be welcome.

Greetings
Carlos

Visual Studio error when trying to open a Feature in a SharePoint Project (An exception occurred while calling 'OnImportsSatisfied')

$
0
0

I am getting the following error message in both Visual Studio 2012 and Visual Studio 2013 when I try to open any "Feature" in a SharePoint 2013 project.

An exception occurred while calling the 'OnImportsSatisfied' method on type 'Microsoft.VisualStudio.SharePoint.Designers.Package.ViewModels.FeatureViewModel'.

(the stack trace then continues on for ages - shown in full below)

I _think_ this started happening when I ran Windows Update recently.

This happens for both old and new projects, both Sandbox and Farm solutions.

I have tried:

  • Removing all Windows Updates from the past week
  • Removing all previous versions of Visual Studio (2012)
  • Completely uninstalling and reinstalling Visual Studio (with reboots inbetween)
  • Installing VS2013 Update 1

Nothing that I do seems to fix this ..

Full Error:

VS Error Message


regards
Martin Hatch
MCPD & MCITP SharePoint 2010
MCTS WSS 3.0 | MOSS 2007
www.martinhatch.com

SingleTask activity in SharePoint 2013 workflow - Send Assignemnt Email

$
0
0

Hi,

I'm using SharePoint 2013 SingleTask activity to create and assign task. However, on task assignment, user is getting notification though the alert is disabled in list level. There's no property in SingleTask expect 'SendReminderEmail' to define in the activity if I would like to send notification or not. Is there any way I can configure in SingleTask activity not to send 'task assignment' notification? My Single Task properties are given below:SingleTask Properties


Thanks,
Sohel Rana
http://ranaictiu-technicalblog.blogspot.com

Which is the best approach? Solution or App?

$
0
0

Hi.

I am new to Sharepoint 2013. I have to develop an attendance system which will be deployed on Office 365 (Sharepoint). I don't know from where I start? Which approach is best? Should I develop an App or Solution?

Thanks in advance.


SharePoint REST and C# Sample to UPDATE LIST ITEM

$
0
0

Somehow I am not able to find a very basic sample of SharePoint REST.

My requirements are

1. C# (no javascript)

2. REST (no CSOM)

3. Update List Item (not just list title)

I did search and find many many resources

http://social.msdn.microsoft.com/Forums/en-US/b1d103a4-71c9-423c-8403-e3dbf519c089/updating-list-items-in-a-document-library-using-sharepoint-2013-rest-api-c?forum=sharepointdevelopment

But they don't contain the answer because 

1. they just change the list title and not the item.

2. use java script

3. Use some very generic tutorial about REST without the specifics of how to update a list item using REST and C#.

I think this is what I am looking for

url: http://site url/_api/web/lists/GetByTitle(‘Test')/items(item id)
method: POST
body: { '__metadata': { 'type': 'SP.Data.TestListItem' }, 'Title': 'TestUpdated'}
headers:
    Authorization: "Bearer " + accessToken
     X-RequestDigest: form digest value“IF-MATCH”: etag or “*”
    “X-HTTP-Method”:”MERGE”,
    accept: "application/json;odata=verbose"
    content-type: "application/json;odata=verbose"
    content-length:length of post body

But I don't know how to convert this into a C# Console Application. (No JavaScript, No Auto-hosted).


How to show site name on AllItems.aspx in a document library or list

$
0
0

Hi,

i want to show a such a navigation so that user can understand in which it is like

sitename>document Library Name>....

How could i achieve this?

Find permissions of the logged in user on a SharePoint2013 list using JSOM

$
0
0

Hi I want to hide  add item link depending upon the logged in USER. So if the logged in User has contributing  rights then  then link should be visible. I want to achieve  the goal using java script (JSOM) on sharepoint 2013. I have tried the following script but it is not working for me. Help is highly appreciated.

<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
<script>
ExecuteOrDelayUntilScriptLoaded(foo,"sp.js");
var web;
var clientContext ;
var currentUser;
var projectList;
var perMask;
function foo()
{
    debugger;
    clientContext = new SP.ClientContext.get_current();
    web = clientContext.get_web();
    currentUser = web.get_currentUser();   
    projectList=web.get_lists().getByTitle('Projects');
       clientContext.load(projectList);
    clientContext.load(currentUser); 
    clientContext.load(web); 
       
   
 clientContext.executeQueryAsync(
        Function.createDelegate(this, this.onQuerySucceeded), 
        Function.createDelegate(this, this.onQueryFailed)
    );


}

function onQuerySucceeded()
{
  //perMask=projectList.getUserEffectivePermissions(currentUser.get_loginName());
  if (projectList.getUserEffectivePermissions(currentUser.get_loginName()).has(SP.PermissionKind.addListItems))
   alert(' you have permissions hi');
}


</script>

start.aspx sharepoint and custom master page SPWEB

$
0
0
Hello ,

I have following problem:
I change master page for SPWeb programmatically ( changed SPWeb.CustomMasterUrl and SPWeb.MasterUrl )
The problem is that some of the pages is opened with _layout/15_start.aspx (Minimal Download Strategy feature)
When I open pages using _layout/15_start.aspx URL, my master is actually old out of the box sharepoint master page.
When I manually change url to actual page(or disable Minimal Download Strategy feature), I see my new custom master.
Is this share point bug or normal behavior?
Why pages with _layout/15_start.aspx URL don't have new masterpage? 

How to implement Ajax toolkit for SharePoint2013?

$
0
0

Hi All,

How to implement Ajax toolkit for SharePoint2013?

Hide field using CEWP in SharePoint 2013

$
0
0

I'm surprised that there aren't any working solutions posted for this for SharePoint 2013. I've tried the related posts in 2010 and 2007, but no love. 

I'm using SharePoint 2013, trying to hide a field with the name "Active" on the new form, using IE 9. I've been hunting all over, and I can't find a working solution to this seemingly simple and common challenge. Could someone spoon feed this one to me, like I'm a toddler, so I can copy and paste it into my CEWP? I'm savvy, but I just don't have more time to hunt this one down or fiddle.

Update SharePoint 2013 list item in a site through a visual web part deployed in another site collection

$
0
0

Hi All,

I am having issues when Updating an item field of a list in SharePoint 2013 site from a visual webpart in a different site collection. Posted the code below.

I am the administrator for both the site but I added elevated rights so user can update items.

The problem is when I deploy and run the code there is no error. But the field is not updating.

When I add "itemToUpdate.Update();" after setting the field , I get "Object reference not set to an instance of an object" . I have posted the exception below as well.

Am I missing anything ??? Any help is much appreciated. Thank you in advance.

private void setReviewStatus()
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                string strURL = string.Empty;
                int listItemId;
                using (SPSite oSPsite = new SPSite("XXXX"))
                {

                    using (SPWeb oSPWeb = oSPsite.OpenWeb())
                    {

                        oSPWeb.AllowUnsafeUpdates = true;
                        // Fetch the List

                        SPList Employeelist = oSPWeb.Lists["Employee"];

                        foreach (SPListItem item in Employeelist.Items)
                        {
                            try
                            {
                                SPFieldUrlValue lnkFieldUrlValueurl = new SPFieldUrlValue(item[EmployeeFieldNameAndReviewStates.strURLField].ToString());
                                strURL = lnkFieldUrlValueurl.Url.ToString();
                            }
                            catch (Exception ex)
                            {

                            }

                            if (!string.IsNullOrEmpty(strURL.ToString()))
                            {

                                if (strURL == getCurrentSiteURL())
                                {
                                    try
                                    {
                                        listItemId = item.ID;
                                        SPListItem itemToUpdate = Employeelist.GetItemById(listItemId);

                                        itemToUpdate["Employee Number"] = "458XXX8687";

                                        
                                        Employeelist.Update();

                                        oSPWeb.AllowUnsafeUpdates = false;
                                    }
                                    catch (SPAlertUpdateException ex)
                                    {
                                      
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            });
         }

Microsoft.SharePoint.SPException was unhandled by user code
  HResult=-XXX
  Message=Object reference not set to an instance of an object.
  Source=Microsoft.SharePoint
  ErrorCode=-XXX
  NativeErrorMessage=FAILED hr detected (hr = XXX)

  NativeStackTrace=""
  StackTrace:
       at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)
       at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bUnRestrictedUpdateInProgress, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
       at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion)
       at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents, String filename, Boolean bPreserveItemUIVersion)
       at Microsoft.SharePoint.SPListItem.Update()
       at VWPStates.KRAWebPart.KRAWebPart.<setReviewStatus>b__0()
       at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()
       at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
  InnerException: System.Runtime.InteropServices.COMException
       HResult=XXX
       Message=<nativehr>XXX</nativehr><nativestack></nativestack>Object reference not set to an instance of an object.
       Source=""
       ErrorCode=-XXX
       StackTrace:
            at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bUnRestrictedUpdateInProgress, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
            at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bPreserveItemUIVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bUnRestrictedUpdateInProgress, Boolean bMigration, Boolean bPublish, String bstrFileName, ISP2DSafeArrayWriter pListDataValidationCallback, ISP2DSafeArrayWriter pRestrictInsertCallback, ISP2DSafeArrayWriter pUniqueFieldCallback)
       InnerException:


How to apply pagination to data bind to control using Camel Query.

$
0
0

Hi All,

I am having a <asp:Repeater> control to which i bind the data from share point list. 

I want to apply pagination to that data which is bind to Repeater. I am using CAMEL query to get data from list. 

How can i apply the pagination to this data fetch by camel which is bined to Repeater control.

Thanks


amol

Advice needed for provider hosted web application - authentication and access to SharePoint document library

$
0
0

I haven't done SharePoint 2013 development with claims so I apologize in advance if my assumptions and questions are way out in left field.

I'm trying to understand SharePoint 2013 claims authentication for a scenario that involves:

  • A SharePoint provided hosted (web forms) app that will pull information and assets (e.g. PDFs) from SharePoint into the web page.
  • It will be a VS 2012 solution with asp.net.identity feature.
  • Security will be set for internal users, federated external users and forms-based external users.  Based on their security and (claim type) role it will define what information and assets that can be retrieved from SharePoint

I have looked through MSDN and other sources to understand.

This one helped with my understanding  Federated Identity for Web Applications and assumed that the general concept could be applied to forms-based identity for non-Federated external users .

What I have now:

  • VS 2012 solution web forms application set to Provider Host with asp.net.identity feature and its required membership tables.
  • I can create new users and associate claims to the new user.
  • I can log in with a user from the membership tables and it will take me to a default.aspx page.  I have added code to it that displays the claims associated to a user.
  • For POC purposes I'd like to retrieve documents that are associated to this user from the default.aspx page.

This is where I am having trouble understanding:  Is my understand correct?

Internal users

  • since they are internal on the network i am assuming that they would already have access to SharePoint and they would already be configured to what documents that they have available to them.

Federated external users & Forms authentication external users

  • it seems to me that the authentication for external users are separate from SharePoint authentication process.
  • changes to the configuration settings are necessary in SharePoint, IIS, web application.I believe this is what i read.
  • claims processes (e.g. mappings) need to be set up in SharePoint
  • as long as external users are authenticated then things are ok b/c they would have claims associated to the user and the configuration in SharePoint takes are of the rest.This statement bothers me because I think it's wrong.

So basically i'm stuck with if my understanding is correct: once a user is authenticated either by federated identity or asp.net.identity authentication that it should go to the provider hosted default.aspx page because the claim is authenticated and means that it should have access to it and the SharePoint document library based on some claim property.  I could then write the calls to retrieve from a document library and SharePoint will know based on some claim property that the logged in user can only access certain documents.

It just sounds too good to be true and that i'm missing something in the thought process.

Thanks in advance for taking the time to read.


greenwasabi


Your search cannot be completed because no search service is available- SP2013

$
0
0

Hi,

We have an application page, in which we need to retrieve the search results in SP2013. However, the query always returns the error "your search cannot be completed because no search service is available". Please find the code below.

 using (SPSite site = new SPSite("http://server"))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        Microsoft.SharePoint.Search.Query.FullTextSqlQuery kq = new FullTextSqlQuery(site);
                       // KeywordQuery kq = new KeywordQuery(site);

                        //KeywordQuery kq = new KeywordQuery(site);
                        kq.SourceId = new Guid(SourceID_Value);
                        kq.QueryText = keyword;
                        kq.RowLimit = 100;
                        kq.AuthenticationType = QueryAuthenticationType.NtAuthenticatedQuery;

                        ResultTableCollection resultTables = new SearchExecutor().ExecuteQuery(kq);
                        ResultTable resultTableFinal = new ResultTable();

                        resultTableFinal = resultTables[ResultType.RelevantResults];
                    }
                }

However, the same code works in a console application executed on the same server. Please let know if you have faced this issue and the solution.


Sreeharsha Alagani | MCTS Sharepoint 2010 | Linkedin | Blog


Is there an issue with iFrame and Target?

$
0
0

I've tried both inserting and embedding this into a Script Editor Web Part,

<iframe id="myIframe" src="http://#" height="200" width="500">
<p>This is my iframe</p>
</iframe>

Then within the main content area I need a number of links to open in this (iFrame) location

e.g.

<p>
When you select <a href="http://#" target="myIframe">this link</a> it will open a new document inside the above window.
</p>

However as soon as I save the changes, the 'target="myIframe" is removed. and the link opens in a new window. 

Am I do something wrong or do I need to approach this via a different method?

caml query for filtering list item not working as expected in Sharepoint hosted app

$
0
0

I am trying to filter list item based on particular value.

var header = "xyz";
camlQueryHeader.set_viewXml = "<view><Query><Where><Eq><FieldRef Name='Position'/>" + "<Value Type='Text'>" + header + "</Value></Eq></Where></Query></view>";

Instead of getting filtered list items, I get all the list items. What am I missing?

Note: I am creating Sharepoint hosted app using CSOM.


regards, Ritesh Anand

Viewing all 7589 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>