If somebody like the post and its helpful in your work then, add comments.

Monday, February 10, 2014

SharePoint 2013 : Create a custom web template from publishing site

Well, to create a custom template in SharePoint 2013 or in Office 365 SharePoint, then it’s a very tricky task to complete. The thing very complex with web template is that, it ok up to publishing feature is not enabled in the Template site. But when the publishing feature is activated the that feature automatically gone from SharePoint web site.

Now, there is trick for that, to add that feature again in Site Settings, juts open that sit in SharePoint designer 2013 and activate/make it true. As this property sets to true the link for “Save as site template” will available.

Now, when we save that site template from(Publishing site) then it will have base template be PUBLISHING. So, now we have to add theme to it and also set our custom master etc. They are all be done in the Onet.xml which is get when we export that WSP in visual Studio export wizard template.

Monday, October 21, 2013

Create SharePoint(2013) Publishing pages using ECMASCRIPT

Well, to create paged from page layouts in the Publishing site in SP2013, I have tried the below code

First get the context for web,

             context = new SP.ClientContext(webUrl);  web = context .get_web();

Then get the publishing web for the site

                               pubweb = SP.Publishing.PublishingWeb.getPublishingWeb(context1, web );

                                context .load(web );

                                context .load(pubweb);                               

                                 context .executeQueryAsync(onquerysucced,onqueryfailed);

In onquerysucced get all the pages in the master page library

            

var pageLibrary = web.get_lists().getByTitle("Master Page Gallery");  

var camlQuery = new SP.CamlQuery;

items = pageLibrary.getItems('');

context .load(items,'Include(Id,Title,File)');

context .executeQueryAsync(onPagelayoutsuccess,onqueryfailed);

 

In onPagelayoutsuccess method

             var listItemEnumerator = items.getEnumerator();

             var listItemInfo = '';

             while (listItemEnumerator .moveNext()) {

            var oListItem = listItemEnumerator.get_current();

                pageItems.push({

                "Id":oListItem.get_id(),

                "Title":oListItem.get_item('Title'),

                "obj" :oListItem //Add Object in the list            

                });

             pageItems.push(oListItem);

             }

             //knockout js work for finding the required page layout item from the list

             var newPage = ko.utils.arrayFirst(pageItems(), function(item) {

                                return item.Title == "CT_PageLayout.aspx";

                                }); 

            

          pageInfo = new SP.Publishing.PublishingPageInformation();

          pageInfo.set_name("CT_PageLayout.aspx");

          pageInfo.set_pageLayoutListItem(newPage.obj);

          newPage = pubweb.addPublishingPage(pageInfo);

          context.load(newPage);

          context.executeQueryAsync(onPageCreationSuccess,onqueryfailed);

         };

         function onPageCreationSuccess(){                                

                                                                listItem = newPage.get_listItem();

                context.load(listItem);

                 context.executeQueryAsync(onPageSuccess,onqueryfailed);

          };

Tuesday, October 8, 2013

SharePoint 2013 : Get SharePoint items in Knockout js observableArray

To get the list tem in the observableArray, just declare a array in the js and get as below code

list = ko.observableArray(),


 getCourses = function () {
var
clientContext = TRANAPP.context;
var oList = clientContext.get_web().get_lists().getByTitle('Courses'
);
var myQueryString = '<View><RowLimit>1000</RowLimit></View>'
;
var newQuery = new
SP.CamlQuery();
newQuery.set_viewXml(myQueryString);
courseItems = oList.getItems(newQuery);
clientContext.load(courseItems,
'Include(Id, Title, CourseDescription, Author)'
);
clientContext.executeQueryAsync(onGettingCourses, onQueryFailed);
},
onGettingCourses =
function
(sender, args) {
var
allCourse = courseItems.getEnumerator();
while
(allCourse.moveNext()) {
var
currentCourse = allCourse.get_current();
list.push({
"Title": currentCourse.get_item('Title'
),
"Id"
: currentCourse.get_id(),
"CourseDescription": currentCourse.get_item('CourseDescription'
)
});
}
},
onQueryFailed = function (sender, args) {
alert(
'Request failed. ' + args.get_message() + '\n'
+ args.get_stackTrace());
},

SharePoint : Open the list item directly to edit mode.

To open the list item directly to edit form instead of the display form.

image

Then we have to edit the view on which the list item is showing. Just open the view in the designer in advanced mode and click on the “Title” column=>SQL server basics.

image

And see the properties which are associated,

image

Change the HREF property to below property just change the “$FORM_DISPLAY” to “$FORM_EDIT”

{$FORM_EDIT}&ID={$ID}&ContentTypeID={$thisNode/@ContentTypeId}

SharePoint 2013 : Add lookup column from in a list from VS2012

To add the lookup column in the SharePoint list in visual studio 2012 wizard we have to create first list from we have to add lookup column in anther list.

image

Then add anther list, like below in this list Course is lookup column

image

Just edit the properties other lookup column ‘Course’, and add the List to =Lists/Courses and  ShowField to Title

image

SharePoint 2013 : Add date and time field on your custom page

Add the date and time SharePoint control in the SharePoint 2013 hosted app.

image

Just drag and drop the controls on the page from toolbox of the VS2012

 

image

The code block will look like as follows :

<SharePoint:DateTimeControl ID="srtDate" ClientIDMode="Static" AutoPostBack="false"
                       runat="server" ToolTip="Start date for training beginning" />

But when you render this control from your app it does not load on the page, and give below screen error.(500 INTERNAL SERVER ERROR)

image
Then add the following property of the control : DatePickerFrameUrl="../_layouts/15/iframe.aspx" and add the ralative pat of the app like as I added “../”. After that it will render the control on the page.

image

Wednesday, September 25, 2013

SharePoint 2013 : Create a declarative workflow in O365 SharePoint Hosted App

Hi,

Well, recently I encountered Smile with one requirement to send email from Office 365 SharePoint Site. The scenario is like send a mail from SharePoint List, and have to take email address from the SharePoint List column, say Email.

Snap

 

image

Variables image
image image
image image
image image
image image
image image
image image
image image

So, In above activity well achieve to send email from list in O365. But still I am looking for sending email’s to other domains.Right Now its sending the email in its domain, like I have created ZapataIndi.onmicrosoft.com.

Sunday, January 20, 2013

Link for “Sign in as Different User” in SharePoint 2013

It’s think the developer team of the SharePoint 2013 forget to add the  “Sign in as a Different User” menu command in SharePoint 2013 Smile

No worry’s we can add that using the below steps(on premise)

  1. Open the Welcome.ascx from “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES”
  2. Find the “<SharePoint:MenuItemTemplate runat="server" id="ID_RequestAccess"”.
  3. Press enter and add
  4. <SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser"
    Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"
    Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"
    MenuGroupId="100"
    Sequence="100"
    UseShortId="true"
    />

  5. Save the welcome.ascx

Now you can see that “Sign in as Different User” appears at drop down.


Signin


 



Enjoy SP 2013

Monday, December 17, 2012

Visual Studio 2012 Project Load Failure Dialog Box for Database Project

Upon loading Visual Studio 2012 RC or Visual Studio 2010, several package load failure messages are shown for SSDT components.

The ‘SqlStudio Editor Package’ package did not load correctly.

Trying to build solution that contains a sql database project (VS 2012 RC). Other projects build fine but database project fails. Error log shows:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(386,5): error MSB4061: The "SqlModelResolutionTask" task could not be instantiated from "C:\Program Files (x86)\Microsoft SQL Server\110\DAC\Bin\Microsoft.Data.Tools.Schema.Tasks.Sql.11.dll".  [C:\a\src\Gamma.Db\Gamma.Db.sqlproj]

SQL Server Data Tools (SSDT) : SQL Server Data Tools (SSDT) transforms database development by introducing a ubiquitous, declarative model that spans all the phases of database development and maintenance/update inside Visual Studio. You can use SSDT Transact-SQL design capabilities to build, debug, maintain, and refactor databases. You can work with a database project, or directly with a connected database instance on or off-premise.

Resolution : Install SQL Server Data Tools (SSDT) in the system and restart the machine

Link to download : http://msdn.microsoft.com/en-us/jj650015

Friday, November 2, 2012

SharePoint 2010 error when trying to delete a managed account: An object in the SharePoint administrative framework, SPManagedAccount Name=managed-account could not be deleted because other objects depend on it. Update all of these dependants to point to null or different objects and retry this operation.

After deleting a User profile Service Application, we may want to clear up the corresponding managed account that we have created for the Service Application.

But we get the above error when we try to deleted the acount from CA-> Securtiy->Configure Managed Accounts.

To resolve this error, we have to use SharePoint PowerShell,

Steps :

  1. Go to Start->Microsoft SharePoint 2010 Products->SharePoint 2010 Management Shell
  2. Paste this commend on the shell “Get-SPServiceApplicationPool” (get a list of the Service Application Pools)
  3.            App
  4. The run the following cmdlet “Remove-SPServiceApplicationPool” and press enter key.
  5. The the service application pool and press enter
  6.          App1
  7. Remove the Managed account via PowerShell by following cmdlets
  8. Get-SPManagedAccount
    Remove-SPManagedAccoun <accounetname>