Archive for the ‘Lists’ Category

I was designing a content page based on a page layout in a publishing site.

Usually I won’t direct users to the NewItem.aspx page or the List or Library directly. The way I provide them to create a new item in my current project is usually by customizing the list from with InfoPath and then using an InfoPath form web part in a publishing page. To be honest that’s an interesting and cool way and I’m happy with that. I do like the publishing feature of SharePoint !!!

However what if you like to open a NewItem form as a dialog directly from a content page. I found some articles like this and a good one here and thanks Baris Bikmaz about the post. You can read them for more information. Here is the summary for my case:

I used a HTML web part and customize the code like this.

<a href="javascript:NewItem2(null, '/<strong>YourSiteAddress</strong>/_layouts/listform.aspx?PageType=8&amp;ListId={<strong>YourListID</strong>}&amp;RootFolder=')">
<img alt="" src="Simple Image Address Which I used Instead of a Text Link" />
</a>

Page type 8 means New form Dialog.

Image tag is optional and you can use a simple text instead.

The good thing about this was that when I customized the list new item form with InfoPath, I wasn’t sure if it would open customized or not. and after testing It worked ! the dialog not only opened but also was based on customized infoPath ! Great! ūüôā

Yesterday I was creating a simple gantt chart in a project task¬†list. The site master page was blueband,master. I found that you cann’t use gantt chart view in a site that uses a blueband as the master page. the gantt is bigger than the width of master page and it seems bad in the page .

Also I could not change my default master page. So the way I found to solve this problem was to directly change the master page of the view by using SharePoint Designer. I opened the list with SharePoint Designer, opened the gantt.aspx view, and with the use of Format menu and then Master Page Section, I changed the master page of this page.

I now however this page looks different from the other pages in the site , but I did not find any other way till now. This corrected the appearnce of the gantt chart.

 

I was trying to create a method to delete all items in a sharepoint list .

here is the code , It’s simple but¬†a question¬†remained¬†for me at the end :


        public void DeleteAllRecords()
        {
            SPList list_a = web.Lists["UserDocs"];
            SPListItemCollection itemsCol = list_a.Items;
            if (itemsCol.Count > 0)
                for (int i = itemsCol.Count-1; i > -1; i--)
                {
                    itemsCol.Delete(i);
                }
        }

I don’t know why the “for” loop does not work when I used it in a incremental way .¬†¬†I mean that I found that I should use it in a decremental way !! I’m trying to find the answer and¬†if so¬†I’ll post it soon.

There was a question in my mind that how is possible to create a list or¬†a document or form library, then¬†create some views in it, but limit simple users to see only one view. and so some specific users (¬†for example managers¬†)¬†see more than one view and it’s possible for them to change¬†between views.

I¬†solved my idea in my way , maybe useful for¬†you ! It’s base on the benefits of using “Edit Page” and using “Target Audiences” . Imagin that we want to limit the users form switching views in Shared Documents Library . You can do it in this way :

So the First step is open this library –> From Site Action select Edit Page

–> on the Web Part Click edit –> click Modify Shared Web Part

You will see the top of the opened tool pane like this picture :

summary view

You see that there’s a “Summary view” in the drop down list. By Selecting it you will see that the “View” section will disapear . So now¬†users can’t change the default view. ūüôā

And for other users ( managers ) you can create a target audineced navigation link that links them to the proper view of the list/library.

Good luck.

Today I was working on an Infopath form. the form retrieved data from a list that had more than 1500 records. but when I previewd the form, my repeating table in the form showed only limited number of rows. ( e.g 100 record )

I found that it’s because of sharepoint lists. In default views the lists are set to show only 100 items,¬†and the others are in the¬†page2,3,… . I found that Infopath can ONLY¬†retrieve data from the page 1 !!! and It can’t read data from page 2¬†and more. it’s strange and I don’t know why !?!

So in this case¬†you should increase the “Item limit” property of your view¬†untill it shows all¬†Items¬†in the first page.¬†and If you are using “Group By”¬†¬†there’s¬†a same number of group per page box. Be careful ! ūüôā